Hi We have a build which consists of several projects which each consists of several modules. We also have a global parent which defines how the build works.
Now, I had the problem that some modules need special steps in their build, e.g. JAXB2 generation, creating an OSGi module etc. Of course, I tried to stick to the Don't Repeat Yourself principle and wanted to administer these special steps myself, instead of leaving it to the individual developers to copy & paste the build configuration over and over. Since including parts of XML into a POM seems to be impossible, I did it with profiles. For example: <!-- Use this profile if you want to generate XML binding classes using JAXB2. --> <profile> <id>jaxb</id> <build> <plugins> <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <schemaDirectory>${jaxb.schema.directory}</schemaDirectory> <generatePackage>${jaxb.package}</generatePackage> <removeOldOutput>true</removeOldOutput> <forceRegenerate>true</forceRegenerate> </configuration> </plugin> </plugins> </build> <properties> <jaxb.schema.directory>src/main/resources</jaxb.schema.directory> <jaxb.package>ch.ipi.${project.artifactId}.xml</jaxb.package> </properties> </profile> Now, if a module wants to use JAXB2, it just has to specify -Pjaxb; so far, so good. I thought this was a nifty solution, but there's a problem with reactor builds: Let's say that I want to build the whole project (modules A, B, C), and module A needs JAXB generation, module B needs an OSGi build etc. The only way I saw until recently was to specify all the profiles required by all the modules when building the whole project. However, for some plugins, this fails miserably, since the plugin *expects* to see certain files, and if it doesn't have them, it breaks the build. Besides, I tell every module to do these special steps, and they only don't execute them because some file/directory is missing (e.g. the XML schema directory), which for me is kind of shaky... The best thing for me would have been to activate a profile based on a Maven property, so I could set the property it in the module's POM. Alas, this idea doesn't work, since Maven only activates profiles based on system properties. Next, I tried activating using files, something like <!-- Use this profile if you want to generate XML binding classes using JAXB2. --> <profile> <id>jaxb</id> <activation> <file> <exists>jaxb.profile</exists> </file> </activation> ... So, module A has a file 'jaxb.profile' in its root directory, module B has 'osgi.profile' etc. This works well on an individual module level, but as soon as I build the whole project, it's totally ignored by the reactor. In other words, I'm stuck! Does anyone have the same kind of build that we have and what's your solution? Is my idea of using profiles for this a valid one or am I totally off "the Maven way"? Should I file a request for enhancement that profiles should be activated by Maven properties? Best regards, Eric --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org