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"?
Related
I am observing whenever I am executing the below command:-
mvn -f pom.xml -Dmaven.repo.local=$MAVEN_REPO -Drat.skip=true -DnoTest=true surefire-report:report
maven is downloading maven-metadata & plugin artifacts every time.
Downloading: http://maven.twttr.com/com/neveda/kekin-storage-metrics/0.001-SNAPSHOT/maven-metadata.xml
...
Downloading: http://artifactory.kekin.local:XXXX/libs-release/org/
I have gone through this answer & my settings.xml looks like below:-
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://artifactory.kekin.local:XXXX/libs-release</url>
</repository>
<repository>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://artifactory.kekin.local:XXXX/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://artifactory.kekin.local:XXXX/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://artifactory.kekin.local:XXXX/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
Environment:-
Maven - 3.5
OS - 10.12.6
I am not sure if this would be a solution for you but you can invoke maven with the --offline switch to stop it from doing any downloads:
mvn --offline -f pom.xml -Dmaven.repo.local=$MAVEN_REPO -Drat.skip=true -DnoTest=true surefire-report:report
This has the side-effect, though, that your build will fail if any artifact is missing.
So I want to setup a config file in Jenkins for a Maven project to use multiple repositories. The whole idea is to try and download from one if it cannot be found then download from the second one. Below is what I have configured now and from the Jenkins logs, I can see it 'downloading' from both repositories.
The problem is that it doesn't actually fallback if it can't find it in the first one it simply fails so something is wrong. I have to add that everything works fine if I use either of them exclusively so it's not a connectivity issue are anything else like that. Please help I have been at this for a day and a half now and I am fairly sure it's because I can't wrap my mind around the Maven Documentation.
[INFO] Downloading: https:NEW_NEXUS/artifact/1.15.0-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http:OLD_NEXUS/artifact/1.15.0-SNAPSHOT/maven-metadata.xml
[INFO]
<?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>new-nexus</id>
<mirrorOf>*</mirrorOf>
<name>New Nexus Repository</name>
<url>NEW_NEXUS/nexus/repository/maven-public/</url>
</mirror>
<mirror>
<id>old-nexus</id>
<mirrorOf>old-nexus</mirrorOf>
<name>Old Nexus Repository</name>
<url>OLD_NEXUS/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>new-nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>old-nexus</id>
<name>Old Nexus Repository</name>
<url>OLD_NEXUS/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>new-nexus</activeProfile>
</activeProfiles>
</settings>
By using
<mirrorOf>*</mirrorOf>
you set the repository as mirror of everything, so every request is redirected to the NEW_NEXUS/nexus/repository/maven-public repository.
What you usually do:
Go into the Nexus as administrator and define a repository group which contains both repositories. Then just use this repository group as mirror of everything. The Nexus repository group behaves as you expect: It goes through all the repositories until it finds the requested artifact.
How can I add a new remote repository in the maven user settings config file?
I added a new option for the one with the id "softwarementors", but when I run the update target on the maven project, it simply redirects to the configured nexus server nexus_server_ip_address.
How can I prevent this? How do I need to adjust the maven config file in order
to add a new remote repository. I replaced the nexus server's ip address with
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>nexus_server_ip_address/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>softwarementors</id> <url>https://repository.sonatype.org/content/groups/forge/com/softwarementors/ex tjs/directjngine/2.2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
The mirrorOf pattern of * causes any repository request to be
redirected to this mirror and to your single repository group, which
in the example is the public group.
https://books.sonatype.com/nexus-book/2.8/reference/maven-sect-single-group.html
Solution 1 : add softwarementors to Nexus
Solution 2 :
Add this.
<mirror>
<id>softwarementors</id>
<mirrorOf>softwarementors</mirrorOf>
<url>https://repository.sonatype.org/content/groups/forge/com/softwarementors/extjs/directjngine/2.2/</url>
</mirror>
<repository>
<id>softwarementors</id>
<name>softwarementors</name>
<url>https://repository.sonatype.org/content/groups/forge/com/softwarementors/extjs/directjngine/2.2/</url>
</repository>
Solution 3:
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*,!softwarementors</mirrorOf>
<url>nexus_server_ip_address/nexus/content/groups/public</url>
</mirror>
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
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.