Scala Enthusiast
Scala Enthusiast

Reputation: 468

Maven command to download latest version of a jar

We have a process to update part of a build that is not in Maven yet but will be soon. Once built, we manually put the jar in Nexus and then update the pom files that are in SVN. Works fine and doing a "mvn clean install" pulls down the new .jar and creates a new folder in my local repository etc. Grand.

Now I would like to be able to get any new version that has been uploaded by making a mvn call without doing a build (as with mvn install). I was looking at mvn dependency:get but it seems to have a lot of parameters that only gave me errors.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get(default-cli) on project workflow-project: The parameters 'repositoryUrl' for goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get are missing or invalid -> [Help 1]

I have tried adding the mentioned repositoryUrl param but it too gives me errors, not least about deprecation. Is this the correct goal? How is it most simply used if so?

Upvotes: 1

Views: 2063

Answers (2)

Lee Meador
Lee Meador

Reputation: 12985

Perhaps you would be happy with a

mvn compile

Which would load the dependencies and compile but go no futher. The only changes would be in target

Upvotes: 0

dsw88
dsw88

Reputation: 4592

Use the Maven Versions plugin. It has a ton of useful commands for managing dependency versions in a POM.

For example, you can run the following:

mvn versions:use-latest-versions

That command will replace versions in your POM with the latest version of artifacts. There are optional parameters you can pass to have more fine-grained control. For example, you can use the includes parameter to specify a particular artifact to update to the latest version.

Upvotes: 4

Related Questions