0
votes

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?

1
"The error I get" and then it's cut off... What error are you getting exactly? Please edit that into your question.TT.
I added more detailsDenis Voloshin

1 Answers

0
votes

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 ...