Hello,

I'm trying to write an ant script which copies some libraries into a
specific location. The libraries are being resolved by loading a maven pom
file.

<target name="updateDependencies">
        <artifact:pom id="pom" file="dependency-pom.xml" />

        <artifact:dependencies filesetId="dependency.fileset" versionsId="
dependency.versions">
            <pom refid="pom" />
        </artifact:dependencies>

        <copy todir="${lib.dir}" overwrite="true">
            <fileset refid="dependency.fileset" />
            <mapper classpathref="maven-ant-tasks.classpath" classname="
org.apache.maven.artifact.ant.VersionMapper" from="${dependency.versions}"
to="flatten"/>
        </copy>
</target>

This task is working well if all the dependency jars are in my local maven
repository. If they are not, the script tries to download them from the
central repository. I have configured a custom miror in my settings.xml but
it looks like that it's not being used. But the custom mirror is being used
when I use the pom file with standard maven.

I have already tried to define the repository in the ant task, but again the
central repository is being used.

<target name="updateRemoteIsovDependencies">
        <artifact:pom id="pom" file="dependency-pom.xml" />

        <artifact:remoteRepository id="remote.repository" url="${
repository.url}"/>

        <artifact:dependencies filesetId="dependency.fileset" versionsId="
dependency.versions">
            <pom refid="pom" />
            <remoteRepository refid="remote.repository"/>
        </artifact:dependencies>

        <copy todir="${lib.dir}" overwrite="true">
            <fileset refid="dependency.fileset" />
            <mapper classpathref="maven-ant-tasks.classpath" classname="
org.apache.maven.artifact.ant.VersionMapper" from="${dependency.versions}"
to="flatten"/>
        </copy>
</target>

Any idea what i'm doing wrong? Thanks for your help!

Kind Regards,
Thomas Tardy

Reply via email to