Hi,
I'm currently stuck with maven integration in ANT. I want to use maven
dependency management in Ant to resolve dependencies.
With the latest version of maven-ant-tasks (2.1.1) I am still not
successful. My main problem is that I cannot import the generated
build-dependencies.xml and if it doesnt exists run artifact:dependencies.
Here is a small part of my build.xml
<import file="${build}/build-dependencies.xml" optional="true" />
<condition property="build-dependencies.present">
<available file="${build}/build-dependencies.xml" />
</condition>
<target name="init-mvn-dependencies"
unless="build-dependencies.present">
<path id="maven-ant-tasks.classpath"
path="lib/maven-ant-tasks-2.1.1.jar"/>
<typedef
resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath"/>
<artifact:pom id="application.pom" file="${basedir}/config/pom.xml"/>
<artifact:dependencies
pathId="application.jars"
filesetId="dependency.fileset"
pomRefId="application.pom"
cacheDependencyRefs="true"
versionsId="dependency.versions"
dependencyRefsBuildFile="${build}/build-dependencies.xml"/>
</target>
<target name="init-dependencies"
if="build-dependencies.present"
depends="maven-dependencies.init-dependencies" />
<target name="mvn-init"
unless="application.jars"
depends="init-dependencies,init-mvn-dependencies">
<echo>dependencyRefsBuildFile: ${build}/build-dependencies.xml</echo>
<property resource="config/application.properties"
classpathref="application.jars"/>
[...]
some targets depend on "mvn-init" and thus on "init-dependencies" or
"init-mvn-dependencies" (depending on the property
"build-dependencies.present"). The problem is that when the property is
not set the targets ("init-dependencies") dependencies
("maven-dependencies.init-dependencies" - declared in
${build}/build-dependencies.xml) must be present. The "if" attribute is
evaluated after the dependencies are resolved.
How can I import a ant build file and run it's default target, getting
all properties declared in it or run "init-mvn-dependencies" if the
imported file does not exists?
As my build file is imported by several submodules I cannot use the
maven-ant-task integrated cache mechanism. It will result in
ClassCastException after the second run of artifact:dependencies in a row.
I'm using Ant 1.8.1
regards
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]