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

bastian kaempfe commented on MANTRUN-51:
----------------------------------------

My guess is that the problem is caused ANT.
ANT simply can set properties only ONE TIME. if you try to set a named property 
severeal times, you succeed only the first time.
every next try does not overwrite the first value, thus when using the 
property, you will always get the first value.

the maven-antrun-plugins tries to set several properties, for example: 
"maven.plugin.classpath".
so the first project wins. every property this antrun-plugin sets will be 
available in every other projet, running after this one.
and no other project can overwrite properties, the first project has set.

maybe the solution could be to start the ant-task in an own java-process, like 
the "fork" of the "maven-compiler-plugin".
another way could be to define a "prefix" or "suffix" for every property that 
will be set by maven within a "maven-antrun-plugin"-block.
could be: prefix="srcgen" -> maven property : "maven.plugin.classpath.srcgen" 
instead of only "maven.plugin.classpath"
or one could use the "maven-antrun-plugin"-"id", if one is provided.
so if my execution-id is "backend-wsdl2java" the maven-set properties could be 
"maven.plugin.classpath.backend-wsdl2java"

i hope, this helps in understanding and solving...


> Can't find plugin dependency in multiproject
> --------------------------------------------
>
>                 Key: MANTRUN-51
>                 URL: http://jira.codehaus.org/browse/MANTRUN-51
>             Project: Maven 2.x Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1
>         Environment: maven 2.0.4, antrun 1.0 & 1.1, jdk 1.5.0_06, windows xp
>            Reporter: Fredrik Vraalsen
>
> I'm using antrun in my project to create an IzPack installation.  The plugin 
> configuration is below.  
> When maven is run from the top-level project, the ant taskdef fails because 
> it cannot find the IzPackTask class.  However, when I run maven from the 
> subproject itself, it works fine.  Not sure if this is related to 
> http://jira.codehaus.org/browse/MANTRUN-49.  The error message from maven is 
> at the bottom.
> {noformat}
> <plugin>
>       <groupId>org.apache.maven.plugins</groupId>
>       <artifactId>maven-antrun-plugin</artifactId>
>       <executions>
>               <execution>
>                       <phase>package</phase>
>                       <configuration>
>                               <tasks>
>                                       <taskdef name="izpack" 
> classname="com.izforge.izpack.ant.IzPackTask"/>
>                                       <izpack 
> input="${project.build.directory}/classes/izPack.xml" 
> output="${project.build.directory}/CorasTool-${coras.version}-installer.jar" 
> basedir="${project.build.directory}"/>
>                               </tasks>
>                       </configuration>
>                       <goals>
>                               <goal>run</goal>
>                       </goals>
>               </execution>
>       </executions>
>       <dependencies>
>               <dependency>
>                       <groupId>izpack</groupId>
>                       <artifactId>standalone-compiler</artifactId>
>                       <version>3.8.0</version>
>               </dependency>
>       </dependencies>
> </plugin>
> [INFO] [antrun:run {execution: default}]
> [INFO] Executing tasks
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Error executing ant tasks
> Embedded error: taskdef class com.izforge.izpack.ant.IzPackTask cannot be 
> found
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error executing ant 
> tasks
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error executing 
> ant tasks
>         at 
> org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:77)
>         at 
> org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:72)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
>         ... 16 more
> Caused by: taskdef class com.izforge.izpack.ant.IzPackTask cannot be found
>         at 
> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:483)
>         at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183)
>         at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>         at org.apache.tools.ant.Task.perform(Task.java:364)
>         at org.apache.tools.ant.Target.execute(Target.java:341)
>         at 
> org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:71)
>         ... 19 more
> Caused by: java.lang.ClassNotFoundException: com.izforge.izpack.ant.IzPackTask
>         at 
> org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1166)
>         at 
> org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1107)
>         at 
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:242)
>         at 
> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
>         ... 24 more
> {noformat}

-- 
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