2

I've been suffering this problem for a while now and can't figure out what the issue might be. It is intermittent which is why I give it half an hour here and there to try to solve it but then end up giving up until I get fed up enough to try again. Now I'm fed up enough to come here and cry about it.

It seems my Maven installation/setup for some reason often won't resolve the version number for dependencies. I think it's only transitive dependencies but not entirely sure. What happens is sometimes when I build my project Maven will try to download dependencies from Artifactory paths where the version number has not been resolved. It will look something like this:

[INFO] --- maven-dependency-plugin:3.3.0:copy (copy-shared-lib) @  myApp ---
Downloading from artifactory: https://repourl:443/artifactory/maven-repo/org/apache/maven/doxia/doxia-sink-api/$%7Bproject.version%7D/doxia-sink-api-$%7Bproject.version%7D.pom

and then this happens for a bunch of dependencies (not only org/apache/maven/...) and it "corrupts" my local maven repo with lots of ${project.version} folders.

The most annoying thing about this is that it's completely intermittent. Often just re-running the target a few times and eventually it works. There's like a 20-80% success rate depending on the day.

Downgrading my proj to earlier versions or even not specifying versions and going with maven defaults have not resolved the issue.

I'm asking first without including a lot of info about my maven config in case someone just knows what it might be but am of course happy to add info if requested.


Edit: this is a bit ironic to see:

enter image description here

And it looks like this for the last few versions of most plugins. Not a given it's related to my issue but it's a similar symptom.

Oskar Lund
  • 339
  • 2
  • 11
  • Why do you use `maven-dependency-plugin:3.3.0:copy` ?? – khmarbaise Apr 14 '22 at 15:14
  • @khmarbaise I inherited the project. Why do you ask and what do you suggest instead? – Oskar Lund Apr 16 '22 at 08:52
  • Usually you deploy artifacts by using `mvn deploy` where dependency plugin is not involved ...so your setup looks a bit weird... furthermore `$%7Bproject.version%7` this looks like you are using a property for a version of artifacts which could be problematic but I don't know because you have not offered enough information...helpful would be a full pom file and a reason why you are using dependencyplugin ? – khmarbaise Apr 16 '22 at 09:14
  • @khmarbaise - Not trying to deploy here. It’s a matter of resolving transitive dependencies. Maven should try to download some specific version from Artifactory (and index it in local mvn repo) but for some reason does not resolve the url before trying to dl. Dependency plugin seems reasonable to use for this. Probably not gonna dump the whole pom here (a lot to clean) but happy to give specific details – Oskar Lund Apr 16 '22 at 14:26
  • Please full pom file... – khmarbaise Apr 16 '22 at 19:42
  • Like I said, not gonna dump a 600 line pom here with mostly irrelevant stuff, but happy to provide specifics – Oskar Lund Apr 20 '22 at 11:58

1 Answers1

0

I had the same error since months, but with different modules

screenshot with an old java-version (error)

I spent a lot of hours, just to figure out, that I just had to update my jdk.

sucessfully tested with

  • oracle jdk 18
  • openjdk 17.0.2+ (confirmed by a collegue)
  • openjdk 17.0.3 (tested locally by myself)

new jdk

here is another thread related to this topic (so you can also see there what i did) Can not resolve ${project.parent.version} to download dependency

Dhananjay C
  • 597
  • 9
  • 34
mr-blubb
  • 11
  • 6