artifactory force update of remote repos - maven

I have had a working artifactory for over a year now. I have set up a virtual repo that has my local (company) artifacts, along with the maven repo (https://repo1.maven.org/maven2) and a few others.
I have a working spring boot app, and I am simply updating to the new 2x version (Currently 2.0.0.M6) my POM parent looks like this:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
When I try and do a mvn install -U I get an error:
[FATAL] Non-resolvable parent POM for org.springframework.boot:myProject:[unknown-version]:
Could not find artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.M6 in central (http://xxx/artifactory/myVirtualRepo/) and 'parent.relativePath' points at no local POM # line 9, column 12
Now when I change that back to my original version (1.5.7.RELEASE) it works fine.
If I manually go and check my artifactory, I do NOT see a 2.0.0.M6 version there. So the error makes sense, but how do I get my Artifactory to "update" or whatever, the newer versions listed on maven central?

Well I am not seeing the artifact you are looking for in Maven central :-)
According to https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-parent/, the artifact's latest version is 1.5.9
If you look at https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent, you can see that the 2.0.0-MX versions are only available on the springio-milestone mirror.
You probably need to add another remote repository that relies on http://repo.spring.io/milestone/, and add it to your virtual repository.
This should fix it.

Related

what is the name of the spring boot starter parent pom? org.springframework.boot:spring-boot-starter-parent

I'm having a maven install issue, where the error is as follows:
[ERROR] Non-resolvable parent POM: Could not find artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.4.RELEASE and 'parent.relativePath' points at wrong local POM # line 16, column 10 -> [Help 2]
org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.4.RELEASE
Here is the entry in pom.xml for the parent pom:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
</parent>
I checked with the dev ops engineer, and he said to check Artifactory to see what version of the spring boot starter parent is there and to use that.
My question is, where/how do I find it within Artifactory? I'm looking under "artifacts", but they are organized by name, not domain, so I need to know what name to look for.
I was facing same issue when I switched from repositories on the internet to an Artifactory repository. The reasons behind my problem were as follows
"Artifactory Requests Can Retrieve Artifacts" configuration was disabled inside advanced section of virtual repository
Artifactory virtual repository was linked with only local repository. So, Artifactory was searching only in local repo. Never tried remote repositories on internet. So, I created a remote repository in Artifactory and linked it with a virtual repository
After addressing the two points above, my build was successful.

Invalid spring-boot-dependency version when using jgitver and local repo in maven

When I use spring-boot-starter-parent combined with local repository and jgitver I get the following error:
[ERROR] The project tmplsvcpkg:TMPL_SVC_NAME-parent:0.0.0-27-a592e4fb-feature_gitlabci-dirty (/home/user/git/service-template/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for org.springframework.boot:spring-boot-starter-parent:[unknown-version]: Could not find artifact org.springframework.boot:spring-boot-dependencies:pom:0.0.0-27-a592e4fb-feature_gitlabci-dirty in internal-repository (https://mvnrepo) # org.springframework.boot:spring-boot-starter-parent:[unknown-version], /home/user/git/service-template/.m2/repository/org/springframework/boot/spring-boot-starter-parent/2.2.0.RELEASE/spring-boot-starter-parent-2.2.0.RELEASE.pom, line 3, column 11 -> [Help 2]
Note unknown-version for spring-boot-starter-parent and 0.0.0-27-a592e4fb-feature_gitlabci-dirty for spring-boot-dependencies. The 0.0.0-27-... version is the version calculated by the jgitver. It looks like the version resolution gets messed up somehow. If I change the local repository to any directory outside of my project it starts working again. If I supress jgitver it starts working again. If I define the local repo even deeper in my project (like maven.repo.local=x/y/z/.m2/repository, the error is still present.
I defined the parent in my pom.xml in this way:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
</parent>
And I run my maven in this way:
mvn compile -Dmaven.repo.local=.m2/repository -U
If I add jgitver.skip=true, everything works.
I suspect it might have something to do with the fact that spring-boot-starter parent defines it's parent (spring-boot-dependencies) as relative to it's position:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent>
Has anyone any ideas why it might be happening and how to fix it?
It turns out it's a well known issue and is resolved by a certain configuration of the plugin (you have to exclude the .m2 directory in plugin config). More details are in this issue:
https://github.com/jgitver/jgitver-maven-plugin/issues/60

Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.5.RELEASE from/to nexus

In my pom.xml, by using the following code, this error comes:
"Project build error: Non-resolvable parent POM for eu.hermes.sbprojects:sb-firstproject:0.0.1-SNAPSHOT:
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.5.RELEASE from/to nexus
https://nexus.myCompanyNexus.de/repository/maven-group/): nexus.myCompanyNexus.de and 'parent.relativePath' points at wrong local POM"
I guess it is proxy problem. But what confusing is, i am at the moment not in office but at home and use my normal wlan at home. As i use Spring Tool Suite as IDE, so i go to Window->Preferences->Network connections.
And set active provider of network connections from Native to Manual.
However, the error is still there.
And i just change the version from the newest 2.1.5 RELEASE to 2.1.0 RELEASE, and it works.
But i do not understand at all, why?
Why i am still at home, it tolds me Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.5.RELEASE from/to of my company?
Why by using a lower version instead of the newest version, it can work?
Thank you!
Regards,
Zi
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
</parent>

How to define parent-version in maven as property?

I'm using the following dependency as parent in my maven pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.6.RELEASE</version>
</parent>
If I define the version as property <version>${spring-boot.version}</version> I'm getting the following error:
Project build error: Non-resolvable parent POM: Failure to transfer
org.springframework.boot:spring-boot-starter-parent:pom:${spring-boot.version}
from http://repo.spring.io/milestone was cached in the local
repository, resolution will not be reattempted until the update
interval of spring-milestones has elapsed or updates are forced.
Original error: Could not transfer artifact
org.springframework.boot:spring-boot-starter-parent:pom:${spring-boot.version}
from/to spring-milestones (http://repo.spring.io/milestone): Illegal
character in path at index 85:
http://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter-parent/${spring-boot.version}/spring-boot-starter-parent-${spring-boot.version}.pom
and 'parent.relativePath' points at wrong local POM
So is it not possible to define the parent version as maven property?
Try updating Maven to 3.2.3.
Check these release notes:
Maven 3.2.1
Maven 3.2.2
There was some work done this front in the latest versions of Maven and it should be possible to do it with version 3.2.1 (at least), but if you're upgrading Maven anyway, go with the latest.

Can't download snapshot artifacts when version is specified by range

In POM could be specified wanted range of artifact version (which in next step will be downloaded by maven-dependency-plugin:copy-dependencies):
<dependencies>
<dependency>
<groupId>my.group</groupId>
<artifactId>hibi-test</artifactId>
<version>[0.1.4-SNAPSHOT,0.2.0)</version>
</dependency>
Problem is that hibi-test has NO releases on my Nexus, - only few SNAPSHOTS (locked timestamp snapshots). I've checked this POM on artifacts which have both releases and snapshots and it worked good, but in that case I've got only:
[ERROR] Failed to execute goal on project Test: Could not resolve dependencies for project my.group:Test:pom:0.0.1-SNAPSHOT: Could not find artifact my.group:hibi-test:jar:0.1.4
Snapshot repository in POM is defined.
I've tried various combination of range, enabling snapshots and versions:unlock-snapshot, but it didn't work. When I passed only 0.1.4-SNAPSHOT artifact hibi-test-0.1.4-SNAPSHOT.jar was downloaded correctly.
What I need here? :)
is 0.2.0 the latest version?
Maybe you should try to change your range of versions.
Try this:
<version> [0.1.4,0.2.0) </version>

Resources