1

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?

2 Answers 2

4

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.

2
  • This might be the one. As I am only looking to update my one particular .jar I have added: mvn versions:use-latest-versions -Dincludes=[groupid]:[artifactid] and that seems to do the job. Thanks. Commented Oct 25, 2013 at 22:37
  • I was hopeful that this was the answer but today I had the first real test when I ran this command and didn't get a new jar but then ran mvn clean install and got a new jar (so there was a new jar in Nexus) :-( Commented Nov 6, 2013 at 17:07
0

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

1
  • 1
    I am trying to avoid compiling. Thank you for letting me know though, sorry if I wasn't clear. Commented Oct 25, 2013 at 22:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.