For the sake of this example, which I am making up off the top of my head, your application is going to consist of 2 JARs and 1 WAR. The WAR should contain the two JAR files in the WEB-INF/lib directory.
So this means you'll have three separate projects, one for each of the artifacts. The two JARs are relatively uninteresting, and from the previous emails, I gather that you've already got that part working. In the WAR project, you'll want to build a project.xml that contains all your project description, including the dependency on the two JARs. You'll want to add a <properties> and <war.bundle> tag to each of those dependencies that looks something like this: <dependency> <groupId>struts</groupId> <artifactId>struts</artifactId> <version>1.1</version> <type>jar</type> <properties> <war.bundle>true</war.bundle> </properties> </dependency> This will tell the WAR plugin to include the artifact (in this case a JAR) in the WEB-INF/lib directory of the resulting WAR file. Once you get to this point, you should be able to execute 'maven war' and have a proper WAR file created in your target/ directory. Now maybe you want to go down the path of having all of these components built together in a single step. This is where you'll want to introduce the multiproject plugin. I setup my projects like this: / + Application + JAR A + JAR B + WAR + root So you would add multiproject properties in the 'root' project that look something like this: maven.multiproject.basedir=${basedir}/../ maven.multiproject.includes=*/project.xml maven.multiproject.excludes=root/project.xml By adding the 'maven.multiproject.type' property to each of your three artifact projects, you'll help the multiproject plugin determine how, and in what order to build your projects. For example, if you execute 'maven multiproject:install', multiproject will look through the list of included project.xml files, and figure out what type of artifact it is. Then it will execute something like 'maven ${maven.multiproject.type}:install'. So for your war file, it is just like you executing 'maven war:install'. Multiproject will run, and build the JARs, then build the WAR, and complete. You could also run 'maven multiproject:deploy' to deploy the resulting artifacts to a repository... Hope that helps. T -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 12:22 PM To: Maven Users List Subject: RE: Single WAR from multiproject Hi Troy, That sounds exactly what we need...but unfortunately I'm a newbie with Maven and you lost me completely in terms of the specifics! Would you mind walking me through it in a bit more detail, please? thanks! David |---------+----------------------------> | | "Poppe, Troy" | | | <[EMAIL PROTECTED]| | | oe.gov> | | | | | | 04/28/2005 09:29 | | | AM | | | Please respond to| | | "Maven Users | | | List" | | | | |---------+----------------------------> >-------------------------------------------------------------------------------- -------------------------------| | | | To: "'Maven Users List'" <users@maven.apache.org> | | cc: | | Subject: RE: Single WAR from multiproject | >-------------------------------------------------------------------------------- -------------------------------| We do something like this, where the artifacts and the war are all part of the same multiproject. Our war artifact project has a property: maven.multiproject.type=war Then when you run 'maven multiproject:install', which then calls war:install, which calls war:webapp. This way you don't have any maven.xml stuff to maintain; its all provided by Maven. T -----Original Message----- From: Arik Kfir [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 27, 2005 8:05 PM To: Maven Users List Subject: Re: Single WAR from multiproject Yes, in the main project add a file called "maven.xml" - you can write your own goals there. Simple write this in the file: <project xmlns:maven="jelly:maven" xmlns:ant="jelly:ant" xmlns:j="jelly:core" xmlns:u="jelly:util"> <goal name="project:create-war" prereqs="multiproject:install,war"/> </project> this should do the trick. have a good one! [EMAIL PROTECTED] wrote: >Hi, > >Thanks!! That works great. > >Only problem is that I now require two steps - the multiproject >jar:install from the top directory, and then the webapp war from the >webapp sub-directory. > >Is there any way to get maven to do both in a single command? > >cheers, > >David > > > >|---------+----------------------------> >| | Arik Kfir | >| | <[EMAIL PROTECTED]| >| | om> | >| | | >| | 04/27/2005 05:10 | >| | PM | >| | Please respond to| >| | "Maven Users | >| | List" | >| | | >|---------+----------------------------> > >----------------------------------------------------------------------- >--------- -------------------------------| > | | > | To: Maven Users List <users@maven.apache.org> | > | cc: | > | Subject: Re: Single WAR from multiproject | > > >--------------------------------------------------------------------- > ------------------------------------------| > > > > >oh, in addition, I would recommend running jar:install on each of the >other projects (you can do this more easily using the multiproject >plugin - http://maven.apache.org/using/multiproject.html) - running >jar:install will "install" the new generated jar of that project into >the repository, from which the war plugin will download and place in >your war file. > >Arik Kfir wrote: > > > >>I assume you have one project containing the web application (prolly >>src/webapp), and the other three generate the class files, which >>result in JAR files that should be placed in the WEB-INF/lib, correct? >> >>If so, simply have the webapp project use the other three as >>dependencies, and in each dependency state that you want its output to >>be included in the war, like this: >> >><dependency> >> <groupId>the_other_proj_grp_id</groupId> >> <artifactId>the_other_proj_id</artifactId> >> <version>...</version> >> <properties> >> *<war.bundle>true</war.bundle>*>> >> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]