Re: [maven2] Generating several artifacts per project ?
Thanks very much for all those useful replies :) - Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1cent;/min.
RE: [maven2] Generating several artifacts per project ?
I didn't see the right answer go by for this (or what I thought was right), so I hope I'm not repeating something. In one of my projects that needs a secondary jar with a subset of classes, I've done the following: build plugins plugin artifactIdmaven-antrun-plugin/artifactId executions execution phasepackage/phase configuration tasks jar basedir=${project.build.outputDirectory} destfile=${project.build.directory}/${project.name}-${project.version}-client.jar include name=org/example/client/**/*.class / /jar /tasks /configuration goals goalrun/goal /goals /execution /executions /plugin plugin groupIdorg.codehaus.mojo/groupId artifactIdbuild-helper-maven-plugin/artifactId executions execution idattach-artifacts/id phasepackage/phase goals goalattach-artifact/goal /goals configuration artifacts artifact file${project.build.directory}/${project.name}-${project.version}-client.jar/file typejar/type classifierclient/classifier /artifact /artifacts /configuration /execution /executions /plugin /plugins /build I've created the secondary jar with a small Ant script bound to the package phase, but obviously there are a number of other ways you could do it. Then you just use the build-helper plugin to attach your jar as another artifact with a classifier to distinguish it from the primary artifact. You'll also need that classifier when referring to the secondary artifact as a dependency. Chris Hilton -Original Message- From: sol myr [mailto:[EMAIL PROTECTED] Sent: Friday, 26 May, 2006 17:50 To: users@maven.apache.org Subject: [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. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [maven2] Generating several artifacts per project ?
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [maven2] Generating several artifacts per project ?
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 artifactIdmaven-assembly-plugin/artifactId executions execution goals goalattached/goal /goals phasepackage/phase /execution /executions configuration descriptors descriptorsrc/main/assembly/client.xml/descriptor descriptorsrc/main/assembly/server.xml/descriptor descriptorsrc/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 idclient/id formats formatjar/format /formats includeBaseDirectoryfalse/includeBaseDirectory fileSets fileSet includes includetarget/classes/my/package1/**/include includetarget/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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[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 ?
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
Re: [maven2] Generating several artifacts per project ?
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 [EMAIL PROTECTED] wrote: Hi, What IDE and VC are you using? Ben On 5/26/06, sol myr [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [maven2] Generating several artifacts per project ?
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [maven2] Generating several artifacts per project ?
On 5/26/06, sol myr [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]