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>
Related
I'm using Intellij IDEA and I have a simple spring boot app.
I'm getting this error when I've imported the pom.xml
Cannot resolve ch.qos.logback:logback-core:1.2.3
Screenshot of the pom.xml :
Add maven central repositories in your pom.xml. This looks missing in the image which you have shared.
<repositories>
<repository>
<id>central</id>
<name>Maven Central</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
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?
I have a POM file
<repositories>
<repository>
<id>bedatadriven</id>
<name>bedatadriven public repo</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
<repository>
<id>cloudera.repo</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
<name>Cloudera Repositories</name>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>vroc</id>
<url>http://repo.vroc.ai:8081/repository/maven-vroc/</url>
<name>VROC Repo</name>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>vroc</id>
<name>Releases</name>
<url>http://repo.vroc.ai:8081/repository/maven-vroc/</url>
</repository>
<snapshotRepository>
<id>vroc</id>
<name>Snapshot</name>
<url>http://repo.vroc.ai:8081/repository/maven-vroc/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.renjin</groupId>
<artifactId>renjin-script-engine</artifactId>
<version>0.8.2527</version>
</dependency>
....
when I run my project it gives below exception. I am not sure how to resolve it
[ERROR] Failed to execute goal on project mdm: Could not resolve dependencies for project ai.vroc:mdm:jar:2.0.0-SNAPSHOT: Could not find artifact org.renjin:renjin-script-engine:jar:0.8.2527 in vroc (http://repo.vroc.ai:8081/repository/maven-public/) -> [Help 1]
[ERROR]
The dependency which gives error is in "bedatadriven" repository but it can not find it. I am not sure how to resolve this error.
You need to change this to be a version in your maven repo
<version>0.8.2527</version>
You will need to browse through http://repo.vroc.ai:8081/repository/maven-public yourself since this is not public (at least to me)
Go to org > renjin > renjin-script-engine, then see what versions are there if any
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"?
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.