(Simple) multiproject question (and war files)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

(Simple) multiproject question (and war files)

Michael Niemaz
Hi all,
    I have a main project which contains several sub-projects.
I'd like to create a bianry 'distrib' that contains all the war files of
the sub-projects.
I thought I could use the multiproject goal but It looks like it only
deals with documentation of sub-projects.
Am I missing something here?
How would you do my war stuff?
I guess I'll have to implement a special goal using the reactor and all.
I just thought there would be outthere something that would do it
automatically.

Any ideas?

--mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: (Simple) multiproject question (and war files)

David Jackman
I did this sort of thing for our product, but instead of doing this at
the multiproject level, I just created another subproject that gathers
all the dependency jars and wars (and other dependency types) for the
product (in our case it dumps them all into a directory that we can then
burn to CD).  If you'd like to take this approach, I can give you more
detail and provide the jelly script I used to gather the dependencies.

..David..


-----Original Message-----
From: Michael Niemaz [mailto:[hidden email]]
Sent: Monday, May 23, 2005 1:38 AM
To: [hidden email]
Subject: (Simple) multiproject question (and war files)

Hi all,
    I have a main project which contains several sub-projects.
I'd like to create a bianry 'distrib' that contains all the war files of
the sub-projects.
I thought I could use the multiproject goal but It looks like it only
deals with documentation of sub-projects.
Am I missing something here?
How would you do my war stuff?
I guess I'll have to implement a special goal using the reactor and all.
I just thought there would be outthere something that would do it
automatically.

Any ideas?

--mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: (Simple) multiproject question (and war files)

Michael Niemaz
I'm almost done but I wouldn't mind having a look at your approach.
Thanx,

--mike

David Jackman wrote:

>I did this sort of thing for our product, but instead of doing this at
>the multiproject level, I just created another subproject that gathers
>all the dependency jars and wars (and other dependency types) for the
>product (in our case it dumps them all into a directory that we can then
>burn to CD).  If you'd like to take this approach, I can give you more
>detail and provide the jelly script I used to gather the dependencies.
>
>..David..
>
>
>-----Original Message-----
>From: Michael Niemaz [mailto:[hidden email]]
>Sent: Monday, May 23, 2005 1:38 AM
>To: [hidden email]
>Subject: (Simple) multiproject question (and war files)
>
>Hi all,
>    I have a main project which contains several sub-projects.
>I'd like to create a bianry 'distrib' that contains all the war files of
>the sub-projects.
>I thought I could use the multiproject goal but It looks like it only
>deals with documentation of sub-projects.
>Am I missing something here?
>How would you do my war stuff?
>I guess I'll have to implement a special goal using the reactor and all.
>I just thought there would be outthere something that would do it
>automatically.
>
>Any ideas?
>
>--mike
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: (Simple) multiproject question (and war files)

David Jackman
In reply to this post by Michael Niemaz
Sure.  For our project, the POM listed as dependencies each of the other
project artifacts.  (This is error prone to some extent (when
adding/removing projects), but not a huge risk for us since our QA group
always starts from the output of this project.  Plus, we're able to add
the other projects' dependencies as well for a complete distributable.)

After doing that, it's fairly straightforward to create a goal that
gathers all of the dependencies into an output directory:
    <goal name="gatherdependencies">
      <ant:mkdir dir="${dest.path}" />  <!-- Dependencies will go here
-->
      <j:forEach var="lib" items="${pom.artifacts}">
        <ant:copy todir="${dest.path}" file="${lib.path}" />
      </j:forEach>
    </goal>

We went a step further and allowed for properties in the POM to indicate
what to do with each dependency.  First, the script should only copy
dependencies with the "install.bundle" property set to true.  If that's
the case, then the dependency can further customize what happens be
setting more properties:  "install.target.path" sets the path (relative
to dest.path) that the dependency should be copied to.
"install.unarchive", if true, tells the script to unzip the dependency
to the target path (not just copy the dependency artifact--a few of our
non-jar artifacts needed this).  And "install.output.filename" sets a
new filename for the dependency when copying (only if
"install.unarchive" isn't used).  Here's the complete script for this:
    <goal name="gatherdependencies">
      <ant:mkdir dir="${dest.path}" />
      <j:forEach var="lib" items="${pom.artifacts}">
        <j:set var="dep" value="${lib.dependency}"/>
        <j:if
test="${dep.getProperty('install.bundle').equals('true')}">
          <j:set var="targetPath"
value="${dep.getProperty('install.target.path')}" defaultValue="" />
          <ant:mkdir dir="${dest.path}/${targetPath}" />
          <j:choose>
            <j:when
test="${dep.getProperty('install.unarchive').equals('true')}">
              <ant:unzip dest="${dest.path}/${targetPath}"
src="${lib.path}" />
            </j:when>
            <j:when test="${dep.getProperty('install.output.filename')
!= null}">
              <j:set var="outputName"
value="${dep.getProperty('install.output.filename')}" />
              <ant:copy
tofile="${dest.path}/${targetPath}/${outputName}" file="${lib.path}" />
            </j:when>
            <j:otherwise>
              <ant:copy todir="${dest.path}/${targetPath}"
file="${lib.path}" />
            </j:otherwise>
          </j:choose>
        </j:if>
      </j:forEach>
    </goal>


-----Original Message-----
From: Michael Niemaz [mailto:[hidden email]]
Sent: Monday, May 23, 2005 8:24 AM
To: Maven Users List
Subject: Re: (Simple) multiproject question (and war files)

I'm almost done but I wouldn't mind having a look at your approach.
Thanx,

--mike

David Jackman wrote:

>I did this sort of thing for our product, but instead of doing this at
>the multiproject level, I just created another subproject that gathers
>all the dependency jars and wars (and other dependency types) for the
>product (in our case it dumps them all into a directory that we can
>then burn to CD).  If you'd like to take this approach, I can give you
>more detail and provide the jelly script I used to gather the
dependencies.

>
>..David..
>
>
>-----Original Message-----
>From: Michael Niemaz [mailto:[hidden email]]
>Sent: Monday, May 23, 2005 1:38 AM
>To: [hidden email]
>Subject: (Simple) multiproject question (and war files)
>
>Hi all,
>    I have a main project which contains several sub-projects.
>I'd like to create a bianry 'distrib' that contains all the war files
>of the sub-projects.
>I thought I could use the multiproject goal but It looks like it only
>deals with documentation of sub-projects.
>Am I missing something here?
>How would you do my war stuff?
>I guess I'll have to implement a special goal using the reactor and
all.

>I just thought there would be outthere something that would do it
>automatically.
>
>Any ideas?
>
>--mike
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]