[ 
http://jira.codehaus.org/browse/MANTRUN-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=151457#action_151457
 ] 

joehni edited comment on MANTRUN-99 at 10/21/08 4:46 AM:
-----------------------------------------------------------------

Each plugin will be loaded once only. The first occurrence will therefore 
define its version and classpath (and this is the same reason why it is really 
a bad idea to create a plugin that declares a dep to another one). In a 
multi-project build you can simply declare the version and *all* additional 
deps of a plugin in the pluginMgmnt section.

      was (Author: joehni):
    Each plugin will be loaded once only. The first occurrence will therefore 
define its version and classpath (and this is the same reason why it is really 
a bad idea to create a plugin that declares a dep to another one). In a 
multi-project build you will can simply declare the version and *all* 
additional deps of a plugin in the pluginMgmnt section.
  
> plugin classpath is invalid in multi-project 
> ---------------------------------------------
>
>                 Key: MANTRUN-99
>                 URL: http://jira.codehaus.org/browse/MANTRUN-99
>             Project: Maven 2.x Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: maven 2.0.6
>            Reporter: Jerome Lacoste
>
> [This is perhaps a maven 2.0.6 issue.]
> pom.xml
> module/pom.xml
> module/pom.xml contains (in a profile enabled by default) an antrun plugin 
> configuration with specific dependencies. The antrun plugin tasks tries to 
> load a custom task (abator) found under the maven.plugin.classpath. This 
> fails if I build from the root when I specify the antrun plugin version in 
> the root POM: the plugin classpath lacks the dependencies. It doesn't fail if 
> I build from the module itself. 
> Something similar to:
>   <profiles>
>     <profile>
>       <id>gen-from-db</id>
>       <activation>
>         <property>
>           <name>!gen.skip</name>
>         </property>
>       </activation>
>       <build>
>         <plugins> 
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-antrun-plugin</artifactId>
>         <executions>
>           <execution>
>             <phase>generate-sources</phase>
>             <configuration>
>               <tasks>
>                 <property name="plugin_classpath" 
> refid="maven.plugin.classpath"/>
>                 <echo message="plugin classpath:  ${plugin_classpath}"/>
>                [...]                
>                 <taskdef name="abator"
>                          
> classname="org.apache.ibatis.abator.ant.AbatorAntTask"
>                          classpath="${plugin_classpath}"/>
>                 <abator ... />
>               </tasks>
>             </configuration>
>             <goals>
>               <goal>run</goal>
>             </goals>
>           </execution>
>         </executions>
>         <dependencies>
>           <dependency>
>             <groupId>org.apache.ibatis.abator</groupId>
>             <artifactId>abator</artifactId>
>             <version>1.0.0</version>
>           </dependency>
>           <dependency>
>             <groupId>com.oracle</groupId>
>             <artifactId>ojdbc14</artifactId>
>             <version>10.2.0.3.0</version>
>           </dependency>
>         </dependencies>
>       </plugin>
> If I build from the module or if I remove the versioning definition in the 
> root POM, I get:
>      [echo] plugin classpath:  
> /home/jerome/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar:/home/jerome/.m2/repository/org/apache/ibatis/abator/abator/1.0.0_edb_1/abator-1.0.0_edb_1.jar:/home/jerome/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar:/home/jerome/.m2/repository/com/oracle/ojdbc14/10.2.0.3.0/ojdbc14-10.2.0.3.0.jar:/home/jerome/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar:/usr/local/lib/maven-2.0.6/lib/maven-core-2.0.6-uber.jar
> which works.
> If in the root pom.xml, I define the version of the antrun plugin under 
> <build><plugins>, the plugin classpath is:
>     [echo] plugin classpath:  
> /home/jerome/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar:/home/jerome/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar:/home/jerome/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar:/usr/local/lib/maven-2.0.6/lib/maven-core-2.0.6-uber.jar
> which fails.
> Workaround so far:
> * do not define the antrun plugin version in parent POM
> * move the plugin dependencies to the project's dependencies, e.g. using test 
> scope, and use the maven.test.classpath instead of the maven.plugin one.
> The problem is probably not related to antrun itself but to maven. I'll see 
> if I get to create a test case. If it's in maven, then I am out of luck, as I 
> am unable to move to a newer version of maven for a while.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to