0

probably it will sound like silly question but I'm stuck. I have ant build.xml which has maven-ant-tasks

<target name="downloadDependencies">
    <artifact:dependencies filesetId="dependency.fileset" useScope="runtime">
        <dependency groupId="<my_artifact_group_id>" artifactId="<my_artifact_id>" version="latest"/>
    </artifact:dependencies>

    <mkdir dir="${build.dir}/lib" />

    <copy todir="${build.dir}/lib">
        <fileset refid="dependency.fileset" />
        <mapper type="flatten" />
    </copy>
</target>

I need to provide the latest version because it's my own artifact, seems like the ant maven task doesn't know to resolve it. The error I get

BUILD FAILED .../build.xml:20: Unable to resolve artifact: Missing: ---------- Try downloading the file manually from the project website.

Then, install it using the command: mvn install:install-file -DgroupId= -DartifactId= -Dversion=latest -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId= -DartifactId= -Dversion=latest -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Question: How can I force the ant maven plugin to resolve the latest version?

A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128
Denis Voloshin
  • 768
  • 10
  • 32

1 Answers1

0

I think your issue is with how you have published the version

mvn install:install-file .... -Dversion=latest ...

To the best of my knowledge Maven doesn't have any special handling or a "latest" string. You must explicitly set a valid version number when installing the artifact. For example

mvn install:install-file .... -Dversion=1.1 ...
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185