Re: [M2] How do I run J2EE compilers?
Thanks for the tip. That has helped me a lot. I noticed that the value of the project.artifact property looks something like this: artifact: org.kurron.maven2:ear-one-WLS:ear:1.0-SNAPSHOT. I don't suppose there is convenient mechanism for obtaining the full path to the EAR, such as: /home/me/.mvn/repository/.../my-app-1.0-SNAPSHOT.ear? I think I have enough data in the mojo to cobble together the pieces I need but I figured I would see if there was something already built in. Many Thanks, Ron Manuel Ledesma wrote: Manuel Ledesma wrote: kurron wrote: Our build system requires us to run vendor-specific J2EE compilers on our EAR files. I ran across the Weblogic plugin that can execute the appc program on an archive but it requires that you specify archive information in the POMs that create EARs. What I would really like is to automagically invoke appc on any EAR that gets built. To that end, I've been experimenting with writing a Java mojo that will invoke appc (or any other program we might need) right after an archive is created. My mojo is getting handed the maven session, executed project, current project and settings but, to this point, I haven't been able to figure out how to obtain the artifact that was just created. I see printouts from my mojo so I know it is getting called. When the mojo asks the executed project or the current project what the artifact is, they return null.The artifact id comes back as empty-project from both objects. Can anyone offer any advice on how to obtain the full path to the artifact that was just created?My mojo is registered to go off during the package phase ( @phase package) and I see it executing after the EAR/JAR/WARs are created so it appears to be getting called when I want it to. Any help is appreciated. Thanks, Ron You can use the following expression //parameter expression=${project.build.directory}/${project.build.finalName} base on packaging you can know if it's an ear, war or ejb. // - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This all you need to write the plugin ** * Compile classpath * * @parameter expression=${project.compileClasspathElements} * @required * @readonly */ private ListString classpathElements; /** * @parameter expression=${project.artifact} */ private Artifact artifact; /** * @parameter expression=${project.packaging} */ private String packaging; I wrote a plugin for appc too. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-M2--How-do-I-run-J2EE-compilers--tf2424323.html#a6776218 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[M2] How do I run J2EE compilers?
Our build system requires us to run vendor-specific J2EE compilers on our EAR files. I ran across the Weblogic plugin that can execute the appc program on an archive but it requires that you specify archive information in the POMs that create EARs. What I would really like is to automagically invoke appc on any EAR that gets built. To that end, I've been experimenting with writing a Java mojo that will invoke appc (or any other program we might need) right after an archive is created. My mojo is getting handed the maven session, executed project, current project and settings but, to this point, I haven't been able to figure out how to obtain the artifact that was just created. I see printouts from my mojo so I know it is getting called. When the mojo asks the executed project or the current project what the artifact is, they return null.The artifact id comes back as empty-project from both objects. Can anyone offer any advice on how to obtain the full path to the artifact that was just created?My mojo is registered to go off during the package phase ( @phase package) and I see it executing after the EAR/JAR/WARs are created so it appears to be getting called when I want it to. Any help is appreciated. Thanks, Ron -- View this message in context: http://www.nabble.com/-M2--How-do-I-run-J2EE-compilers--tf2424323.html#a6759058 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[M2] Java Mojo Packaging Question
I'm try ing to write a Java-based mojo that executes after the normal packaging work has been done and the artifact has created. There are some custom post-processors or validators that might be required to run and I wanted to explore how that might be accomplish thru a custom mojo. Anyway, my mojo is getting handed the maven session, executed project, current project and settings but, to this point, I haven't been able to figure out how to obtain the artifact that was just created. I see printouts from my mojo so I know it is getting called. When the mojo ask the executed project or the current project what the artifact is, they return null.The artifact id comes back as empty-project from both objects. Can anyone offer any advice on how to obtain the full path to the artifact that was just created?My mojo is registered to go off during the package phase ( @phase package) and I see it executing after the EAR/JAR/WARs are created so it appears to be getting called when I want it to. Any help is appreciated. Thanks, Ron -- View this message in context: http://www.nabble.com/-M2--Java-Mojo-Packaging-Question-tf2356714.html#a6564355 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: WANTED: Suggestions on performing vendor-specific builds
I had looked at the profile documentation but obviously not close enough. I had originally thought that it would only allow me to set properties. Upone further inspection I see that I can also modify the modules list. My current solution, for those who might care, is to create a POM-based profile that controls the list of modules that will be built. The profiles are triggered off of the -D property specifying which container is targetted. Thanks for the suggestion. POM.xml snippet !-- Since we have platform-specific modules, we need to enumerate them using profiles that are triggered off of a system property-- profiles profile idWeblogic/id activation property nameplatform/name valueWLS/value /property /activation modules modulewls-specific/module modulepojo-one/module moduleejb-one/module moduleweb-one/module moduleear-one/module /modules /profile profile idWebSphere/id activation property nameplatform/name valueWAS/value /property /activation modules modulewas-specific/module modulepojo-one/module moduleejb-one/module moduleweb-one/module moduleear-one/module /modules /profile /profiles Alexander Sack-3 wrote: Ronald, I have a very similar setup in my projects where ANT was used based on an if clause. In fact I wound up actually using ant-contrib to give me if/else type logic to make the builds more readable. Have you looked into Maven2 style PROFILES? A profile allows you to define a number of configuration parameters based on some activation property (system property I think is currently the only thing supported) as well as a command line define, think -Dweblogic passed to mvn. Here is a pointer: http://maven.apache.org/guides/introduction/introduction-to-profiles.html -aps On 9/13/06, Ronald Kurr [EMAIL PROTECTED] wrote: I've been looking at Maven 2 as a replacement to a current ANT-based build system and I'm looking for ideas on how I might be able to translate one of the features it currently provides. The code base supports multiple J2EE containers. Sometimes we have to build two different versions of the same code with each version relying on vendor-specific APIs. Sometimes modules are built only when a certain vendor's container is targeted. We handle triggering of optional but vendor-specific modules via the if attribute of the target tag. For example, target name=do-websphere-only-module if=websphere ... /target We handle the triggering of mandatory but vendor-specific code by naming conventions and property values. For example, our source directories are layed out similar to this: source/java/neutral source/java/weblogic source/java/websphere When the ANT build is kicked off, a property is set to indicate the target platform: -Dvendor=weblogic. When then use the value of the property to construct the source path for that build: path id=compile.source.path pathelement location=source/java/neutral/ pathelement location=source/java/${vendor}/ /path This allows us to only include the correct vendor-specific source during the build. We use a similar technique when building out the classpath which contains vendor-specific libraries. I'm trying to figure out how I might achieve similar functionality under Maven 2 and could use some suggestions. My first idea was to house the mandatory but vendor-specific code in their own modules and use a naming convention coupled with a property to control which module gets invoked by the parent module. For example, module names: mandatory-webshere/ mandatory-weblogic/ mandatory-jboss/ parent POM: modules modulemandatory-${vendor}/module modulepojo-one/module moduleejb-one/module moduleweb-one/module moduleear-one/module /modules That seems to work but I'm open to other ideas. What I haven't been able to figure out is how to configure the only build this module if the target is Webshere logic. Any ideas are appreciated. I'd like to avoid having to drop down to ANT using the maven-antrun-plugin or writing a custom plugin but I'll try whatever suggestions are provided. Many Thanks, Ron -- What lies behind us and what lies in front of us is of little concern to what lies within us. -Ralph Waldo Emerson -- View this message in context: http://www.nabble.com/WANTED%3A-Suggestions-on-performing-vendor-specific-builds-tf2265358.html#a6310402 Sent from the Maven - Users forum at Nabble.com.