You've run into a limitation/bug of Maven 2.x, where all executions of a plugin in a multi-module project has the same classpath. It has been fixed in Maven 3 (since one of the alphas).
/Anders On Sun, Jun 27, 2010 at 12:31, Sachin Jain <[email protected]> wrote: > There is a top level pom.xml which calls two sub > modules as below: > <modules> > <module>module1</module> > <module>module2</module> > </modules> > > Where module2 is dependent on module1 > The xjc plugin configuration in module1 pom.xml is as below: > <build> > <plugins> > <plugin> > <groupId>com.sun.tools.xjc.maven2</groupId> > <artifactId>maven-jaxb-plugin</artifactId> > <executions> > <execution> > <goals> > <goal>generate</goal> > </goals> > </execution> > </executions> > <configuration> > <strict>false</strict> > <extension>true</extension> > <verbose>true</verbose> > </configuration> > </plugin> > </plugins> > </build> > > The xjc configuration in module2's pom.xml is as below: > <build> > <plugins> > <plugin> > <groupId>com.sun.tools.xjc.maven2</groupId> > <artifactId>maven-jaxb-plugin</artifactId> > <dependencies> > <dependency> > <groupId>com.mycompany.module1</groupId> > <artifactId>module1</artifactId> > <version>1.0</version> > <scope>runtime</scope> > </dependency> > </dependencies> > <executions> > <execution> > <goals> > <goal>generate</goal> > </goals> > </execution> > </executions> > <configuration> > <includeSchemas> > <includeSchema>schema.xsd</includeSchema> > </includeSchemas> > <includeBindings> > <includeBinding>bindings.xjb</includeBinding> > </includeBindings> > <strict>false</strict> > <extension>true</extension> > <verbose>true</verbose> > <args>-Xpdm</args> > </configuration> > </plugin> > </plugins> > </build> > > Now when I run mvn from top level directory then module2 build fails, I get > the below error: > [INFO] unrecognized parameter -Xpdm > [INFO] > ------------------------------------------------------------------------ > [INFO] Trace > unrecognized parameter -Xpdm > at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:446) > at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:434) > > The reason for this error was because module1 dependency was not used while > XJC plugin execution during module2 build. > My question: why module2's xjc plugin configuration did not come into > effect? > When I run mvn in module2 directory it works fine but from top level > directory it fails. > Any help, what I am missing at? > >
