You need to unify the classpath for the plugin. Which, in your case, means
that you need to refactor your projects.

This issue is just one of the reasons I always recommend going Maven 3.

/Anders

On Sun, Jun 27, 2010 at 13:35, Sachin Jain <[email protected]> wrote:

> Thanks Anders for quick clarification. Any workaround if I wanted to stick
> to 2.x?
> ...Sachin
>
>
>
>
> ________________________________
> From: Anders Hammar <[email protected]>
> To: Maven Users List <[email protected]>
> Sent: Sun, 27 June, 2010 5:02:15 PM
> Subject: Re: Can we define a plugin with different configuration in multi
>  module pom project
>
> 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?
> >
> >
>
>
>

Reply via email to