Score:0

download newest build of an artifact using maven in the command line

in flag

All I want at the end of the day is for the puppet-managed servers in our development environment to always pull the latest build of the latest version of whatever application they are running. While maven isn't exactly intended for that, since all the shadowjars live in the same repository as their dependencies, and all come with md5 checksums to compare files that maven already generated, it seemed an obvious choice.

Trouble is, while I managed to pull the latest version through the command line, I have miserably failed in getting maven to check the pom.md5 to decide whether it needs to update a local jar or not. I tried some things with the dependency plugin, but when it already has a file with the same version locally, it just refuses to update it, even though the repository holds a newer build of that version. So I've tried some things with the versions plugin, but again all I ever got are version numbers. I looked at the checksum plugin, but it seems dedicated to generating checksums. There's one check goal, but it requires some csv that I don't have, and I'm not sure how to get.

Really, all I want to do is for maven to compare the remote .jar.md5 with the local copy, and re-download the jar if they don't match, even if it's the same version. And I'd like to do it from the command line. But my hair is getting gray trying to do it...

Score:0
ba flag

You want to call using mvn -U, as answered here.

The Snapshots Update Download policy is controlled by a setting:

updatePolicy String The frequency for downloading updates - can be "always", "daily" (default), "interval:XXX" (in minutes) or "never" (only if it doesn't exist locally).

You can also use the command mvn maven-dependency-plugin:purge-local-repository to do as it says, forcing a new download when you run mvn dependency:resolve or lifecycle goal generate-sources or higher (ie: compile).

Score:0
de flag

Maven is very efficient in dependency management. Thus is never re-downloads release jars.

Option 1

Make the version to be SNAPSHOT

Option 2 specify a version range

<version>[1.0,)</version>

At the end run

mvn -U -C clean package (or what ever you need)
UncleBob avatar
in flag
That's just the issue, these *are* snapshots. The problem is not getting the newest version. That would be easy. The problem is getting the newest build of a snapshot version that is already installed.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.