Maven wants to access central.maven.org - java

Since a few days, my maven build on gitlab (maven:3.6.3-jdk-11) tries to access central.maven.org and fails with
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact javax.media:jai_core:jar:1.1.3 from/to central.maven.org (http://central.maven.org/maven2): Transfer failed for http://central.maven.org/maven2/javax/media/jai_core/1.1.3/jai_core-1.1.3.jar
...
Caused by: java.net.UnknownHostException: central.maven.org: Name or service not known
I haven't changed the settings.xml. It looks like this:
...
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo1.maven.org/maven2/</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo1.maven.org/maven2/</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
...
That is, I haven't configured a lookup for central.maven.org.
Even the maven super pom does not contain this url, according to
https://maven.apache.org/ref/3.6.3/maven-model-builder/super-pom.html
Where does this come from and how can I fix this?

Related

Maven HTTPS migration throwing 501

There is a private artifact being imported to a maven project. The artifact is being stored in a folder named repository. Was using f/w snippet to import the dependency
<repositories>
<repository>
<id>local-repo</id>
<url>file://${basedir}/repository</url>
</repository>
</repositories>
The project was last built on December, 2019 using Apache Maven 3.3.9. Now the build is throwing following error:
[ERROR] Failed to execute goal on project target-jar: Could not resolve dependencies for project a.package:target-jar:jar:0.0.1-SNAPSHOT:
Failed to collect dependencies at private.package:private-artifact:jar:1.1.1:
Failed to read artifact descriptor for private.package:private-artifact:jar:1.1.1:
Could not transfer artifact private.package:private-artifact:pom:1.1.1 from/to central-backup (http://repo.maven.apache.org/maven2):
Failed to transfer file: http://repo.maven.apache.org/maven2/private/package/private-artifact/1.1.1/private.package:private-artifact-1.1.1.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
Tried f/w solution but no luck.
New repo info in pom.xml:
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>local-repo</id>
<url>file://${basedir}/repository</url>
</repository>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

eclipse "maven->update" throws handshake_failure. "mvn clean install" works

I'm trying to get eclipse to accept a remote repo. Here's my maven settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
<server>
<id>***-releases</id>
<username>MyUsername</username>
<password>secret</password>
</server>
<server>
<id>***-snapshots</id>
<username>MyUsername</username>
<password>secret</password>
</server>
<server>
<id>***-public</id>
<username>MyUsername</username>
<password>secret</password>
</server>
<server>
<id>***-custom-releases</id>
<username>MyUsername</username>
<password>secret</password>
</server>
</servers>
<mirrors>
<mirror>
<id>jboss-public</id>
<name>JBoss Public Nexus Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<mirrorOf>jboss</mirrorOf>
</mirror>
<mirror>
<id>MyCentral</id>
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<proxies/>
<profiles>
<profile>
<id>repository</id>
<repositories>
<repository>
<id>repository</id>
<name>repository</name>
<url>file:/C:/Users/myUsername/.m2/repository/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>***-releases</id>
<url>https://www.***/nexus/content/repositories/***-releases/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>***-snapshots</id>
<url>https://www.***/nexus/content/repositories/***-snapshots/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>***-public</id>
<url>https://www.***/nexus/content/groups/public/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>***-custom-releases</id>
<url>https://www.***.de/nexus/content/repositories/***-custom-releases/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>fusesource</id>
<url>http://repo.fusesource.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>***-public</id>
<url>https://www.***/nexus/content/groups/public/</url>
</pluginRepository>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>***-releases</id>
<url>https://www.***/nexus/content/repositories/***-releases/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>repository</activeProfile>
</activeProfiles>
If I run mvn clean install from the terminal or eclipse, the build succeeds. However, if I click "Maven->Update Project" in Eclipse, I get the following error message:
Project build error: Non-resolvable parent POM for ***:***:*** Failure to transfer ***:***:pom:*** from https://www.***/nexus/content/repositories/***-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of ***-snapshots has elapsed or updates are forced.
Original error: Could not transfer artifact ***:***:pom:*** from/to ***-snapshots (https://www.***/nexus/content/repositories/***-snapshots/): Received fatal alert: handshake_failure and 'parent.relativePath' points at wrong local POM pom.xml /*** line 4 Maven pom Loading Problem
The "'parent.relativePath' points at wrong local POM" doesn't worry me, since the parent pom is in the remote repository and since there is no connection to it, the error makes sense to me.
In eclipse I've set my maven-installation to ".../myMaven" under "preferences->Maven->Installations". However, in the same menu, eclipse tells me this: "Note: Embedded runtime is always used for dependency resolution". I'm guessing that's the reason why the resolution works when running mvn clean install but doesn't work when I'm trying to update the project with eclipse.
I've also set the Environmentvariable 'MAVEN_OPTS' to this:
-Djavax.net.ssl.trustStore=C:\cacerts\trust.jks -Djavax.net.ssl.trustStorePassword=secret -Djavax.net.ssl.keyStore=C:\cacerts\PC2***.pfx -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=secret
These settings seem fine to me, since I can build from the terminal.
How can I bring eclipse to use the same configs when running "update project"?

Fuse esb doesn't take settings.xml

I want to install hawtio using repository in my local net typing in console osgi:install mvn:io.hawt/hawtio-web/1.2.3. This repository is not behind proxy. But I receive an error:
settings.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>company-nexus</id>
<name>some name Nexus Repo</name>
<mirrorOf>*,!np-snapshots,!public-snapshots</mirrorOf>
<url>http:/mysite/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>companyRepo</id>
<properties>
<nexus.repo>mysite</nexus.repo>
</properties>
<pluginRepositories>
<pluginRepository>
<id>np-snapshots</id>
<url>http://${nexus.repo}/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>public-snapshots</id>
<url>http://${nexus.repo}/nexus/content/groups/public_snapshots/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>np-snapshots</id>
<url>http://${nexus.repo}/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>public-snapshots</id>
<url>http://${nexus.repo}/nexus/content/groups/public_snapshots/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>companyRepo</activeProfile>
</activeProfiles>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.mysite</host>
<port>3128</port>
<username>myProxyUsername</username>
<password>myProxyPassword</password>
<nonProxyHosts>nexus.mySite</nonProxyHosts>
</proxy>
org.ops4j.pax.url.mvn.cfg file:
http://pastebin.com/q5GZnVGX
Error:
http://pastebin.com/3mk7DnUi
I'm using jboss-fuse-6.0.0.redhat-024
To clarify - Does your local repository have direct access to the Internet, and is it setup to mirror all of the default fuse repositories (e.g. the ones in 'org.ops4j.pax.url.mvn.repositories')?
It's also useful to enable debug logging as I believe you'll then be able to see the repositories fuse is using to resolve the bundle (e.g. log:set debug)
Personally i'd trial and error. First i'd add 'http:/mysite/nexus/content/groups/public' to the 'org.ops4j.pax.url.mvn.repositories' setting, remove the mirror from settings.xml and see if it works. If it does, it indicates an issue taking the mirror settings.
According to the Hawito documention, you should try
features:addurl mvn:io.hawt/hawtio-karaf/1.3.0/xml/features
features:install hawtio

Can't get a Maven repo working with Nexus Server

I'm a bit new to Maven. I thought I was getting a pretty good handle on it. I guess not.
I want to set up a dependency on SVNKit 1.7.0-alpha1. According to their website, They have a releases repo located at http://maven.tmatesoft.com/content/repositories/releases/
Also, they shared:
GroupId: org.tmatesoft.svnkit
ArtifactIds: svnkit, ...
version: 1.3.7, 1.3.8-SNAPSHOT, 1.7.0-alpha1, 1.7.0-SNAPSHOT
So, I added the following to my pom.xml:
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit</artifactId>
<version>1.7.0-alpha1</version>
</dependency>
And
<repositories>
<repository>
<id>tmatesoft-releases</id>
<url>http://maven.tmatesoft.com/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>tmatesoft-snapshots</id>
<url>http://maven.tmatesoft.com/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>tmatesoft-releases</id>
<url>http://maven.tmatesoft.com/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>tmatesoft-snapshots</id>
<url>http://maven.tmatesoft.com/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
...
</distributionManagement>
</repositories>
But when I do a maven build on the project, it doesn't appear to even check the repo I provided.
Any thoughts on where I'm going wrong here?
UPDATE
Found the answer. One of our company's more experienced buildmasters gave me a bit of background on how a nexus server works. I had a sneaking suspicion that the dependencyManagement section was relevant.
To fix this (if you have a Nexus server), you'll have to add the third-party repo to the Nexus Server. Then it should work fine.
Found the answer. One of our company's more experienced buildmasters gave me a bit of background on how a nexus server works. I had a sneaking suspicion that the dependencyManagement section was relevant.
To fix this (if you have a Nexus server), you'll have to add the third-party repo to the Nexus Server. Then it should work fine.

How to set order of repositories in Maven settings.xml

I have 3 repositories in my settings.xml because I need artifacts from all of them. Whenever a dependency is not found, Maven tries
Downloading: http://some.server/mvn2repo/releases/org/apache/lucene/lucene-core/2.9.1/...
[INFO] Unable to find resource 'org.apache.lucene:lucene-core:pom:2.9.1' in repository
Downloading: http://some.server/mvn2repo/3rdParty/org/apache/lucene/lucene-core/2.9.1/...
[INFO] Unable to find resource 'org.apache.lucene:lucene-core:pom:2.9.1' in repository
Downloading: http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.9.1/lucene-core-2.9.1.pom
<success>
all repositories, but most of the time finds the artifact in central (repo1) of course. I want Maven to check this repo first. I tried order of declarations in settings.xml, but did not work. According to fgysin I also tried the reverse order, which didn't change anything.
My Maven version:
C:\>mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_15
Java home: C:\Program Files\Java\jdk1.6.0_15\jre
Default locale: de_AT, platform encoding: Cp1252
OS name: "windows vista" version: "6.0" arch: "amd64" Family: "windows"
My settings.xml
<profiles>
<profile>
<id>space</id>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>s1-releases</id>
<name>System One Releases</name>
<url>http://some.server/mvn2repo/releases</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>s1-3rdParty</id>
<name>System One 3rd Party Releases</name>
<url>http://some.server/mvn2repo/3rdParty</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>space</activeProfile>
</activeProfiles>
As far as I know, the order of the repositories in your pom.xml will also decide the order of the repository access.
As for configuring repositories in settings.xml, I've read that the order of repositories is interestingly enough the inverse order of how the repositories will be accessed.
Here a post where someone explains this curiosity:
http://community.jboss.org/message/576851
None of these answers were correct in my case.. the order seems dependent on the alphabetical ordering of the <id> tag, which is an arbitrary string. Hence this forced repo search order:
<repository>
<id>1_maven.apache.org</id>
<releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>true</enabled> </snapshots>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
</repository>
<repository>
<id>2_maven.oracle.com</id>
<releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>false</enabled> </snapshots>
<url>https://maven.oracle.com</url>
<layout>default</layout>
</repository>
Also, consider to use a repository manager such as Nexus and configure all your repositories there.

Categories

Resources