Here is an example of doing wath you want, I think.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-test-sources</phase>
<configuration>
<tasks>
<ant
antfile="src/test/ant/build.xml" inheritRefs="true"/>
</tasks>
<testSourceRoot>target/generated-sources/nextmock</testSourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
> -----Original Message-----
> From: Giles, Nick [mailto:[EMAIL PROTECTED]
> Sent: 23 December 2005 11:51
> To: [email protected]
> Subject: [m2] Antrun / Javac
>
> I'm having distinct problems with the Antrun plugin for Maven2,
> specifically with the inheritance of properties and environment
> variables. With a simple test where the pom.xml calls a build.xml, which
> then uses javac, Ant complains about not being able to find
> com.sun.tools.javac.Main on the classpath. This isn't the usual Ant
> problem that gives that message, because Ant will run fine from the
> command line, it's an inheritance from Maven problem. With the files
> described below, I get a negligible classpath in the Maven part of the
> operation, and a null classpath in the Ant part. If I run the buildfile
> from the commandline, I get a full and proper classpath, and execution
> works.
>
> Does anyone have any idea how I can get this to work, and why it does
> work in one of my projects, but I'm scared to change it to try and find
> out why, because I'll never get it back to working again...
>
> Cheers,
>
> Nick
>
> ====
>
> Pom.xml:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>workbench</groupId>
> <artifactId>workbench</artifactId>
> <packaging>jar</packaging>
> <version>1.0-SNAPSHOT</version>
>
>
> <build>
> <sourceDirectory>.</sourceDirectory>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <phase>generate-sources</phase>
> <configuration>
> <tasks>
> <echo message="Classpath in Antrun task =
> ${java.class.path}"/>
> <ant antfile="build.xml" dir="." inheritAll="true" >
> </ant>
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> </project>
>
> ======
>
> Build.xml:
>
> <project name="Workbench" default="run" basedir=".">
>
> <target name="run" depends="clean,compile">
> <java classname="Workbench" />
> </target>
>
> <target name="compile">
> <echo message="Classpath in Ant: ${java.class.path}" />
> <javac srcdir="." />
> </target>
>
> <target name="clean">
> <delete>
> <fileset dir=".">
> <include name="*.class" />
> </fileset>
> </delete>
> </target>
>
> </project>
>
>
> =====
>
> Workbench.java:
>
>
> public class Workbench {
>
> public static void main(String[] args) {
> System.out.println("Hello");
> }
>
> }
>
> This message may contain privileged and/or confidential
> information. If you have received this e-mail in error or are not the
> intended recipient, you may not use, copy, disseminate or distribute it;
> do not open any attachments, delete it immediately from your system and
> notify the sender promptly by e-mail that you have done so. Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]