I'm trying to build using multiple versions of the cxf-codegen-plugin. I've distilled the problem into the following project structure:
pom.xml A/ A/pom.xml (cxf-codegen-plugin version 2.0.2-incubator) B/ B/pom.xml (cxf-codegen-plugin version 2.1.1) The top level pom.xml has a modules section that lists project A and project B. Project A runs cxf-codegen-plugin version 2.0.2-incubator and project B runs cxf-codegen-plugin version 2.1.1. If I run mvn package in either the A directory or the B directory, the right version of the CXF plugin is executed, but if I run the top level pom.xml, cxf-codegen-plugin version 2.0.2-incubator is used for both project A and project B. The correct versions of the CXF jars are put on the compiler classpath though. The goal is to get the top level pom.xml to build both project A and project B. I'm somewhat new to Maven, so maybe I'm not going about this the right way. What's the best way for me to get the correct versions of cxf-codegen-plugin to run? I've pasted the above mentioned pom.xml files. Thanks, Peter top level pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>both-projects</artifactId> <version>1.0</version> <packaging>pom</packaging> <name>Both Projects</name> <modules> <module>A</module> <module>B</module> </modules> </project> A/pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>A</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>Project A</name> <properties> <cxf.version>2.0.2-incubator</cxf.version> </properties> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${cxf.version}</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/resources/myservice.wsdl</wsdl> <extraargs> <extraarg>-validate</extraarg> <extraarg>-verbose</extraarg> </extraargs> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> B/pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>B</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>Project B</name> <properties> <cxf.version>2.1.1</cxf.version> </properties> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${cxf.version}</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/resources/myservice.wsdl</wsdl> <extraargs> <extraarg>-validate</extraarg> <extraarg>-verbose</extraarg> </extraargs> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> My maven version info: Maven version: 2.0.9 Java version: 1.5.0_16 OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
