ok, here's something you might want to try...
1) Create 'target-profiles' in ~/.m2/settings.xml. These profiles should setup
only the properties that you need to interpolate with different values for
your project-type profiles.
See: http://www.nabble.com/-m2-outputDirectory-t892251.html
2) Have a parent POM where you set up Profiles (like you have now) but
which factors out most of the common stuff for your plugin configuration.
Note that you can interpolate properties from ~/.m2/settings.xml in this
POM.
You will need to activate multiple profiles to be able to interpolate the key
values from ~/.m2/settings.xml
3) Have the child POMs extend from parent and override or supplement the
Plugin configuration with any additional conf.
I am not sure if you can set up and interpolate XML CDATA for properties, but
give it a shot!
HTH.
Cheers,
Rahul
----- Original Message -----
From: "Sanjay Choudhary" <[EMAIL PROTECTED]>
To: "Maven Users List" <[email protected]>
Sent: Sunday, January 15, 2006 5:54 AM
Subject: Re: M2 - Help needed with profiles
I will try to decribe the Use Case. Projects decribed below are using RAD
6.0 (base is eclipse 3.0.2)
In RAD6.0, we have 3 different kind of projects, and more, but for this
discussion 3 are sufficient.
1. Java
2. EJB
3. Web
Each of the above projects have different entries in the following sections
in .project files
1. buildcommands.
2. project natures.
In my application we have
Parent POM
Project - A extends parent POM - Java project
Project - B extends parent POM - Java project
Project - C extends parent POM - EJB project
Project - D extends parent POM - EJB project
Project - F extends parent POM - Web project
Project - G extends parent POM - Web project
(I have several projects in my workspace of different types).
Currently, I am forced to define Eclipse plugin entries in each of the
projects Also entries get duplicated in similar kind of projects. For
example, Java projects ( project A and project B) will have the following
entries for eclipse plugin in the POM
<buildcommands>
<java.lang.String>
org.eclipse.jdt.core.javabuilder
</java.lang.String>
<java.lang.String>
com.ibm.sse.model.structuredbuilder
</java.lang.String>
<java.lang.String>
com.ibm.etools.ctc.serviceprojectbuilder
</java.lang.String>
</buildcommands>
<projectnatures>
<java.lang.String>
org.eclipse.jdt.core.javanature
</java.lang.String>
<java.lang.String>
com.ibm.etools.ctc.javaprojectnature
</java.lang.String>
</projectnatures>
Similarly, EJB projects will have dupliaction for properties I am trying to
avoid this duplication. Thought profile should be the way to go (there may
be another way too) but don't know how exactly to achieve this.
Thanks,
Sanjay
On 1/13/06, Rinku <[EMAIL PROTECTED]> wrote:
Hi,
What's the exact use case here?
Do you know that M2 can merge profiles so you can avoid some duplication
by
factoring out common elements into a parent POM.
Having said that, it would be a good idea to have some more details on
what you
are intending to do.
Cheers,
Rahul
----- Original Message -----
From: "Sanjay Choudhary" <[EMAIL PROTECTED]>
To: "Maven Users List" <[email protected]>
Sent: Saturday, January 14, 2006 12:50 PM
Subject: M2 - Help needed with profiles
I read the following on maven website
Profiles specified in the POM can modify the following POM elements:
- *repositories*
- *pluginRepositories*
- *dependencies*
- *plugins*
- *properties* (not actually available in the main POM, but used
behind the scenes)
- *modules*
- *reporting*
- *dependencyManagement*
- *distributionManagement*
- a subset of the *build* element, which consists of:
- *defaultGoal*
- *resources*
- *testResources*
- *finalName*
*I am interested in creating two profiles to modify eclipse plugin in the
parent POM. One profile is for EJB project and other one is for Java
project. I guess this is not the right way of doing it as I get errors
when
I do so. Please help me in configuring the profile right way. This will
save me from duplication the plugin in code in serveral projects.*
**
<profiles>
<profile>
<id>javaprojects</id>
<activation>
<property>
<name>package</name>
<value>jar</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<classpathContainers>
<java.lang.String>
org.eclipse.jdt.launching.JRE_CONTAINER
</java.lang.String>
<java.lang.String>
com.ibm.wtp.server.java.core.container
/com.ibm.etools.websphere.runtime.core.runtimeTarget.v50/was.base.v5
</java.lang.String>
</classpathContainers>
<buildcommands>
<java.lang.String>
org.eclipse.jdt.core.javabuilder
</java.lang.String>
<java.lang.String>
com.ibm.sse.model.structuredbuilder
</java.lang.String>
<java.lang.String>
com.ibm.etools.ctc.serviceprojectbuilder
</java.lang.String>
</buildcommands>
<projectnatures>
<java.lang.String>
org.eclipse.jdt.core.javanature
</java.lang.String>
<java.lang.String>
com.ibm.etools.ctc.javaprojectnature
</java.lang.String>
</projectnatures>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${pom.url}</url>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerVersion>1.3</compilerVersion>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ejbprojects</id>
<activation>
<property>
<name>package</name>
<value>ejb</value>
</property>
</activation>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>WSEJBDEPLOY</id>
<phase>package</phase>
<configuration>
<tasks>
<echo message="This is test message"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<copy todir="target/classes/META-INF">
<fileset dir="ejbModule/META-INF">
<include name="**.xm*"/>
</fileset>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${pom.url}</url>
</manifestEntries>
</archive>
<generateClient>true</generateClient>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<outputDirectory>ejbModule</outputDirectory>
<classpathContainers>
<java.lang.String>
com.ibm.wtp.server.java.core.container
/com.ibm.etools.websphere.runtime.core.runtimeTarget.v50/was.base.v5
</java.lang.String>
</classpathContainers>
<buildcommands>
<java.lang.String>
com.ibm.wtp.migration.MigrationBuilder
</java.lang.String>
<java.lang.String>
com.ibm.etools.webtools.LibDirBuilder
</java.lang.String>
<java.lang.String>
org.eclipse.jdt.core.javabuilder
</java.lang.String>
<java.lang.String>
com.ibm.etools.validation.validationbuilder
</java.lang.String>
<java.lang.String>
com.ibm.etools.j2ee.LibCopyBuilder
</java.lang.String>
<java.lang.String>
com.ibm.etools.ctc.serviceprojectbuilder
</java.lang.String>
<java.lang.String>
com.ibm.sse.model.structuredbuilder
</java.lang.String>
</buildcommands>
<projectnatures>
<java.lang.String>
com.ibm.wtp.ejb.EJBNature
</java.lang.String>
<java.lang.String>
org.eclipse.jdt.core.javanature
</java.lang.String>
<java.lang.String>
com.ibm.etools.ctc.javaprojectnature
</java.lang.String>
</projectnatures>
</configuration>
</plugin>
</plugins>
</profile>
</profiles>
**
*Thanks,*
*Sanjay*
**
---------------------------------------------------------------------
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]