You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Kevin Jackson <fo...@gmail.com> on 2007/02/21 11:12:17 UTC
Odd use case for import...
Hi all,
I've just come unstuck with <import>.
I have an archive of a set of files (jars, xml etc) which I've
installed in my maven repo (~/.m2/repository/f.q.d.n.<my archive>)
Inside that archive I have a common.xml file which contains a set of
common ant tasks. I want to be able to extract the archive from the
maven repo and then import the common tasks and then run said common
tasks. Problem <import> cannot be nested in a target so I'm stuck
with a broken import as the file hasn't been extracted (yet) and I
cannot setup a dependency to a previous target (extract).
Now a workaround may be to use <ant> to delegate to the file as I can
nest this in a target which will then ensure that my dependencies are
fine, but I'm wondering if anyone has a better suggestion.
build.xml :
<project name="my-mail"> <!-- name changed to protect the innocent :) -->
<target name="setup" description="Configures properties">
<property file="build.properties"/>
<property name="mvn.repo" value="${user.home}/.m2/repository"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="src.tools.dir" value="${src.dir}/tools"/>
<property name="src.tools.build.dir" value="${src.tools.dir}/build"/>
<property name="ant.common.dir" value="${src.tools.build.dir}/ant"/>
<!-- used for temporary files generated during installation-->
<property name="build.dir" value="${basedir}/build"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${src.tools.build.dir}"/>
</target>
<target name="extract-mail-lib" depends="setup" description="Gets the
lib from m2 repo">
<!-- unzip mvn repo version of james -->
<unzip
src="${mvn.repo}/com/seanergie/lib/${artifact-id}/${maven-version}/${artifact-id}-${maven-version}.jar"
dest="${src.tools.dir}"
/>
</target>
<import file="${ant.common.dir}/common.xml"/>
</project>
Thanks,
Kev
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org