After some searching I found that the antrun plugin exposes
maven.dependency.classpath to ant as a ref. It can be referenced with:
<property name="depClasspath" refid="maven.dependency.classpath" />
Brian
On 11/11/05, Brian Bonner <[EMAIL PROTECTED]> wrote:
> I tried adding switching the taskdef to:
>
> <taskdef name="attribute-compiler"
> classname="org.apache.commons.attributes.compiler.AttributeCompiler"
> classpath="${project.compileClasspathElements}" />
>
> I think this change puts the necessary class on the classpath for the
> taskdef, but I still get this error which leads me to believe that it
> didn't work.
>
> [ERROR] BUILD ERROR
> [INFO]
> -------------------------------------------------------------------------
> ---
> [INFO] Error executing ant tasks
>
> Embedded error: taskdef class
> org.apache.commons.attributes.compiler.AttributeCo
> mpiler cannot be found
> [INFO]
> -------------------------------------------------------------------------
> ---
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error executing ant
> task
> s
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
> ultLifecycleExecutor.java:544)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
> fecycle(DefaultLifecycleExecutor.java:469)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
> ltLifecycleExecutor.java:448)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
> dleFailures(DefaultLifecycleExecutor.java:301)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
> ts(DefaultLifecycleExecutor.java:268)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
> fecycleExecutor.java:137)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> 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 t
> asks
> at
> org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractA
> ntMojo.java:77)
> at
> org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:72)
>
> at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
> nManager.java:399)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
> ultLifecycleExecutor.java:519)
> ... 16 more
> Caused by: taskdef class
> org.apache.commons.attributes.compiler.AttributeCompile
> r 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(AbstractA
> ntMojo.java:71)
> ... 19 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.attributes.compi
> ler.AttributeCompiler
> at
> org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoa
> der.java:1166)
> at
> org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:110
> 7)
> at
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977
> )
> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:219)
> at
> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
>
> ... 24 more
> [INFO]
> -------------------------------------------------------------------------
>
> On 11/11/05, Brian Bonner <[EMAIL PROTECTED]> wrote:
> > My classpath issue is probably related to this post:
> > http://www.nabble.com/referencing-a-property-defined-in-pom.xml-t526453.html#a1421590
> >
> > On 11/11/05, Brian Bonner <[EMAIL PROTECTED]> wrote:
> > > I'm trying to run the commons-attributes attribute compiler.
> > >
> > > I have commons-attribute and the common-attributes-api as dependencies:
> > >
> > > <dependency>
> > > <groupId>commons-attributes</groupId>
> > > <artifactId>commons-attributes-api</artifactId>
> > > <version>2.1</version>
> > > </dependency>
> > > <dependency>
> > > <groupId>commons-attributes</groupId>
> > >
> > > <artifactId>commons-attributes-compiler</artifactId>
> > > <version>2.1</version>
> > > </dependency>
> > >
> > > And I've added the following plugin config in pom.xml, which I'm
> > > modifying from the commons-attribute example at:
> > > http://jakarta.apache.org/commons/attributes/ant_demo/build.xml
> > >
> > >
> > > <!-- using antrun temporarily to call the
> > > commons-attributes -->
> > > <plugin>
> > >
> > > <groupId>org.apache.maven.plugins</groupId>
> > >
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > <executions>
> > > <execution>
> > >
> > > <phase>generate-sources</phase>
> > > <configuration>
> > > <tasks>
> > > <taskdef
> > > resource="org/apache/commons/attributes/anttasks.properties" />
> > >
> > > <attribute-compiler destdir=".">
> > >
> > > <fileset dir="." includes="*.java" />
> > >
> > > </attribute-compiler>
> > > <javac
> > > srcdir="." destdir="${basedir}" deprecation="true"
> > > debug="true" classpath="${ant.home}/lib/commons-attributes-api-2.1.jar;."
> > > optimize="false"></javac>
> > > <java
> > > classpath="${ant.home}/lib/commons-attributes-api-2.1.jar;."
> > > classname="AttributeDemo" />
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > <goal>run</goal>
> > > </goals>
> > > </execution>
> > > </executions>
> > > </plugin>
> > >
> > >
> > >
> > > However, I'm getting errors saying it can't find the task. I realize
> > > that my classpath is probably incorrect, but I"m not sure what to set
> > > it to to include the classpath dependencies. I've looked here
> > > (http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/)
> > > for the plugin expressions, but I'm just not getting it.
> > >
> > > Can anyone suggest how to get the dependency classpath that I can use in
> > > antrun?
> > >
> > > Brian
> > >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]