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.
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>
I am attempting to publish maven builds to a ProGet feed using an API key from a Jenkins server. However, I continue to get an Unauthorized response from the ProGet server. I have my repository setup in my settings.xml file as such:
<repository>
<id>snapshots</id>
<name>ProGet Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>https://proget.domain.com/maven2/snapshots?key=00000000000</url>
<layout>default</layout>
</repository>
Is there something wrong with my maven settings, or an authentication problem on ProGet?
Many thanks.
From the Proget Q&A page, I finally discovered that you set the repository configuration to:
<username>api</username>
<password>API_KEY</password>
in the settings.xml file.
I want to build a java application that runs a sqoop job, does some hdfs operations and alters metadata in hive.
To achie all this, I have created a maven project, but i run into dependency issues all the time.
Can somebody give me a example pom.xml, so I can start to write my application?
Thank you!
HDP Maven Artifacts
pom.xml repositories
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>hortonworks.extrepo</id>
<name>Hortonworks HDP</name>
<url>http://repo.hortonworks.com/content/repositories/releases</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>hortonworks.other</id>
<name>Hortonworks Other Dependencies</name>
<url>http://repo.hortonworks.com/content/groups/public</url>
</repository>
Add <dependency> section for example, hadoop-common:2.7.3.2.5.0-37 where that is the hadoop version + HDP version
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.