I'm trying to use the Ant libs for Maven 2.0.2 to handle dependencies
(and to unpack some files needed during the ant build).
I'm using a pom.xml in which I've bound the maven dependency plugin to
the "validate" phase,using the "unpack" goal:

pom.xml:
...
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>dependency-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>junit</groupId>
                                    <artifactId>junit</artifactId>
                                    <version>3.8.1</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>unpacked</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>


My ant file has:
build.xml:

<project default="usage" name="My App 2"
    xmlns:artifact="urn:maven-artifact-ant"
    >
 
    <property name="maven.ant.jar"
value="/devtools/maven-artifact-ant-2.0.2-dep/maven-artifact-ant-2.0.2-d
ep.jar"/>
    
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant">
        <classpath>
            <pathelement location="${maven.ant.jar}"/>
        </classpath>
    </typedef>
    
    <artifact:pom id="maven.project" file="pom.xml" />
    
    
    <target name="test">
        <artifact:install>
            <pom refid="maven.project"/>
        </artifact:install>
    </target>
</project>


The dependency is fetched and unpacked as expected when I run maven
directly via :
mvn validate
or
mvn install

However, when I run ant (to try and trigger the fetch) via:
ant test

I get:
Buildfile: build.xml

test:

BUILD FAILED
C:\ibttest\my-app2\build.xml:41: java.lang.NullPointerException

Total time: 1 second

I've tried binding the "unpack" to the install phase also, but this
gives the same error.

Is there a better way to use the AntLib to pull down (and unpack)
dependencies at the start of an ant build process?

Related, but maybe off topic: Is it possible to the "validate" goal
directly using the AntLib?

Thanks,
Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to