Suppose I have an A:jar module whose dependencies on the execution and compilation cycles depend on the version of the JDK. In my example, I have a pre-jdk6-profile for the JAXB API: before JDK 1.6.0, I need to enable jaxb-api-nnn.jar as a compilation dependency, This profile is placed in A.pom .
I also have a B:war module, which depends on A:jar . I want to be able to activate this profile on the build server to build JDK 1.5.x. When I start Maven with the given profile, I get the message:
mvn -Ppre-jdk6-profile -o install [WARNING] Profile with id: 'pre-jdk6-profile' has not been activated.
and jaxb-api-nnn.jar missing as a result of B.war . However, if I activate this profile when creating from the parent pom.xml , everything is fine. This means that profiles are not inherited from dependencies, and the parent multi-module pom.xml was able to correctly build everything, because it seems that all profiles are combined into a reactor.
Changing the profile to the parent pom complicates the situation, since dependencies apply to all other projects (for example, to C:ear ). Are there any good solutions for this problem, namely, if any module A depends on module B , then all the correct processing of compilation and execution dependencies that are activated by the profile?
The profile in project A:jar follows:
<project ...> <artifactId>A</artifactId> <packaging>jar</packaging> ... <parent> <artifactId>P</artifactId> ... </parent> <profiles> <profile> <id>pre-jdk6-profile</id> <activation> <jdk>(,1.6.0)</jdk> </activation> <dependencies> <dependency> <groupId>javax.xml.ws</groupId> <artifactId>jaxws-api</artifactId> </dependency> </dependencies> </profile> </profiles> ... </project>
maven-2
dma_k
source share