You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by sol myr <so...@yahoo.com> on 2006/05/27 00:49:51 UTC

[maven2] Generating several artifacts per project ?

Hi,
   
  Newbie question:
  Is it possible to generate several artifacts (jars) from the same project ?
  I have a single project (single POM, with no sub-projects). I'd like to make it so that when I call 'mvn package', it will create 3 different jars  (say, "client.jar", "server.jar", and "util.jar"), and place them all under 'target'.
   
  I *know* this goes agains the recommendations & phylosophy of Maven2... 
  But we really must limit ourselves to a single POM, due to limitations of my company's IDE and version control.
   
  Thanks.

		
---------------------------------
Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.

Re: [maven2] Generating several artifacts per project ?

Posted by sol myr <so...@yahoo.com>.
Thanks very much for all those useful replies :)


		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1&cent;/min.

Re: [maven2] Generating several artifacts per project ?

Posted by Mark Hewett <ma...@gmail.com>.
You may be able to use the assembly plugin to do something like what
you want - although I'm not sure if the extra jars will make it into
your repository so that you could depend on them in other projects.

Bind the assembly:attached target into your build process in your
pom.xml with something like:

...
<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <executions>
        <execution>
          <goals>
            <goal>attached</goal>
          </goals>
          <phase>package</phase>
        </execution>
      </executions>
      <configuration>
        <descriptors>
          <descriptor>src/main/assembly/client.xml</descriptor>
          <descriptor>src/main/assembly/server.xml</descriptor>
          <descriptor>src/main/assembly/util.xml</descriptor>
        </descriptors>
      </configuration>
    </plugin>
  </plugins>
</build>
...

The client/server/util.xml files should be something like (see
documentation for the assembly plugin at
http://maven.apache.org/plugins/maven-assembly-plugin/introduction.html)...

<assembly>
  <id>client</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <includes>
        <include>target/classes/my/package1/**</include>
        <include>target/classes/my/package2/**</include>
      </includes>
    </fileSet>
  </fileSets>
</assembly>

This should build the extra jars in your target directory during the
package phase.

Hope this is helpful, and if anyone more experienced than me has any
input on this method (like it sucks! :-), please let me know.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [maven2] Generating several artifacts per project ?

Posted by Geoffrey De Smet <ge...@gmail.com>.
You can hack it by creating 3 virtual projects: client, server, util
(3 different pom.xmls) that all use the same src dir but with <excludes> 
and <includes>.
It's described somewhere in the mini guides (I can't remember which one).

/src/java (all sources)
/pom.xml (multiproject)
/client/pom.xml
/server/pom.xml
/util/pom.xml

Still, you'll probably have problems with your .project/.classpath 
generated for eclipse etc.

With kind regards,
Geoffrey De Smet


sol myr wrote:
> Hi,
>    
>   Newbie question:
>   Is it possible to generate several artifacts (jars) from the same project ?
>   I have a single project (single POM, with no sub-projects). I'd like to make it so that when I call 'mvn package', it will create 3 different jars  (say, "client.jar", "server.jar", and "util.jar"), and place them all under 'target'.
>    
>   I *know* this goes agains the recommendations & phylosophy of Maven2... 
>   But we really must limit ourselves to a single POM, due to limitations of my company's IDE and version control.
>    
>   Thanks.
> 
> 		
> ---------------------------------
> Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [maven2] Generating several artifacts per project ?

Posted by Wendy Smoak <ws...@gmail.com>.
On 5/26/06, sol myr <so...@yahoo.com> wrote:

>   Now, management authorized a pilot project with maven2, but we've been instructed to patch it up to work with the existing plugin/scripts... If the pilot succeeds, we might change our framework, but it's an egg-and-chicken thing...

Been there, done that, with Maven 1 under similar circumstances:  a
parallel build with no changes to the project structure.  Never again.
 We got it to work, but it was painful for everyone involved, and NOT
a good example of what Maven can do.

This is just not a fair test for Maven.  Is there any way you can
arrange to take part or all of the project to a 'sandbox' area where
you have the freedom to do some restructuring?

Second choice is to put the poms in a separate directory structure,
and use relative paths and include/exclude to get it to build separate
jars from a single source tree.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [maven2] Generating several artifacts per project ?

Posted by ben short <be...@benshort.co.uk>.
Im sure i read that a Microsoft employee once said the following, your
source code would be safer if you printed it outand burnt it than in
vss. hehe.

What about if you, create 3 projects, client, server and util. have 3
ides open and pull in the utils.jar dependancy to the other two.?

Or

Setup the parent child type structure for your project and run the mvn
commands in an external shell or cmd prompt.



On 5/27/06, sol myr <so...@yahoo.com> wrote:
> Thanks for the quick reply :)
>
>   Our IDE/VC is a long and boring story... Basically, it's Eclipse 2.1 with Visual SourceSafe, but we have our own customized Eclipse plugin, and our scripts that deploy through FTP.
>   Both the plugin and the scripts support only a single project.
>   Now, management authorized a pilot project with maven2, but we've been instructed to patch it up to work with the existing plugin/scripts... If the pilot succeeds, we might change our framework, but it's an egg-and-chicken thing...
>
>   Thanks again.
>
> ben short <be...@benshort.co.uk> wrote:
>   Hi,
>
> What IDE and VC are you using?
>
> Ben
>
> On 5/26/06, sol myr wrote:
> > Hi,
> >
> > Newbie question:
> > Is it possible to generate several artifacts (jars) from the same project ?
> > I have a single project (single POM, with no sub-projects). I'd like to make it so that when I call 'mvn package', it will create 3 different jars (say, "client.jar", "server.jar", and "util.jar"), and place them all under 'target'.
> >
> > I *know* this goes agains the recommendations & phylosophy of Maven2...
> > But we really must limit ourselves to a single POM, due to limitations of my company's IDE and version control.
> >
> > Thanks.
> >
> >
> > ---------------------------------
> > Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
> ---------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [maven2] Generating several artifacts per project ?

Posted by Alexandre Poitras <al...@gmail.com>.
The EBJ plugin is able to generate secondary artifact (ejb-client) so
yes it's possible but a very bad practice.

On 5/26/06, ben short <be...@benshort.co.uk> wrote:
> Hi,
>
> What IDE and VC are you using?
>
> Ben
>
> On 5/26/06, sol myr <so...@yahoo.com> wrote:
> > Hi,
> >
> >   Newbie question:
> >   Is it possible to generate several artifacts (jars) from the same project ?
> >   I have a single project (single POM, with no sub-projects). I'd like to make it so that when I call 'mvn package', it will create 3 different jars  (say, "client.jar", "server.jar", and "util.jar"), and place them all under 'target'.
> >
> >   I *know* this goes agains the recommendations & phylosophy of Maven2...
> >   But we really must limit ourselves to a single POM, due to limitations of my company's IDE and version control.
> >
> >   Thanks.
> >
> >
> > ---------------------------------
> > Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [maven2] Generating several artifacts per project ?

Posted by sol myr <so...@yahoo.com>.
Thanks for the quick reply :)
   
  Our IDE/VC is a long and boring story... Basically, it's Eclipse 2.1 with Visual SourceSafe, but we have our own customized Eclipse plugin, and our scripts that deploy through FTP. 
  Both the plugin and the scripts support only a single project.  
  Now, management authorized a pilot project with maven2, but we've been instructed to patch it up to work with the existing plugin/scripts... If the pilot succeeds, we might change our framework, but it's an egg-and-chicken thing...
   
  Thanks again.

ben short <be...@benshort.co.uk> wrote:
  Hi,

What IDE and VC are you using?

Ben

On 5/26/06, sol myr wrote:
> Hi,
>
> Newbie question:
> Is it possible to generate several artifacts (jars) from the same project ?
> I have a single project (single POM, with no sub-projects). I'd like to make it so that when I call 'mvn package', it will create 3 different jars (say, "client.jar", "server.jar", and "util.jar"), and place them all under 'target'.
>
> I *know* this goes agains the recommendations & phylosophy of Maven2...
> But we really must limit ourselves to a single POM, due to limitations of my company's IDE and version control.
>
> Thanks.
>
>
> ---------------------------------
> Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

Re: [maven2] Generating several artifacts per project ?

Posted by ben short <be...@benshort.co.uk>.
Hi,

What IDE and VC are you using?

Ben

On 5/26/06, sol myr <so...@yahoo.com> wrote:
> Hi,
>
>   Newbie question:
>   Is it possible to generate several artifacts (jars) from the same project ?
>   I have a single project (single POM, with no sub-projects). I'd like to make it so that when I call 'mvn package', it will create 3 different jars  (say, "client.jar", "server.jar", and "util.jar"), and place them all under 'target'.
>
>   I *know* this goes agains the recommendations & phylosophy of Maven2...
>   But we really must limit ourselves to a single POM, due to limitations of my company's IDE and version control.
>
>   Thanks.
>
>
> ---------------------------------
> Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org