Repositories specified in pom.xml are not used by maven? - maven

I am compiling HBase using Maven3.
The pom from github https://github.com/cloudera/hbase/blob/cdh4-0.94.2_4.2.1/pom.xml specified some repositories to provide some external jars. But maven 3 doesn't look for jars from these repositories and just throws exception says the jar is not found from mirror.
Here is the repositories from pom.
<repositories>
<repository>
<id>cdh.repo</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
<name>Cloudera Repositories</name>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>cdh.snapshots.repo</id>
<url>https://repository.cloudera.com/artifactory/libs-snapshot-local</url>
<name>Cloudera Snapshots Repository</name>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>apache release</id>
<url>https://repository.apache.org/content/repositories/releases/</url>
</repository>
<repository>
<id>apache non-releases</id>
<name>Apache non-releases</name>
<url>http://people.apache.org/~stack/m2/repository</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>java.net</id>
<name>Java.Net</name>
<url>http://download.java.net/maven/2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>codehaus</id>
<name>Codehaus Public</name>
<url>http://repository.codehaus.org/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>repository.jboss.org</id>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>ghelmling.testing</id>
<name>Gary Helmling test repo</name>
<url>http://people.apache.org/~garyh/mvn/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
-----------------------updated 2013-11-28 13:53----------------------------
My bad. The problem is
<mirrors>
<mirror>
<id>public</id>
<mirrorOf>*</mirrorOf>
<url>http://mavenrepo.mycorp.com:8081/nexus/content/repositories/public</url>
</mirror>
</mirrors>
<mirrorOf>*</mirrorOf> should be <mirrorOf>central</mirrorOf>. By using *, it will be used to handle all download request of all repos. And surely the repo of company doesn't mirror 3rd part repos resources

Posting my guess as an answer.
Your problem seems to be that in your settings.xml you have a <mirrors/> section which is overriding the repositories defined in your pom.xml.

Related

Moving maven profiles in setting.xml to pom.xml

I am using maven3. I have some user specific profiles and activeProfiles tags defined in settings.xml and I want to move them to project's pom.xml.
But merely copying profiles and activeProfiles from settings.xml to pom.xml does not work and breaks build because it tries to find project's parent pom in maven central instead of artifactory. Here's my settings.xml profiles.
Maven reports problem:
Failure to find xxx:xxx:pom:19.2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
Can someone please help ?
{
<profiles>
<profile>
<id>group</id>
<repositories>
<repository>
<id>nb_releases</id>
<name>Releases</name>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://artifactory.xxxx.xxxx/nb-m2</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
<profile>
<id>snapshots-group</id>
<repositories>
<repository>
<id>nb_snapshots</id>
<name>Snapshots</name>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://artifactory.xxxx.xxxx/nb-m2-snapshot</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
<profile>
<id>plugins</id>
<pluginRepositories>
<pluginRepository>
<id>nb_plugins</id>
<name>Plugins</name>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://artifactory.xxx.xxx/nb-m2</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>group</activeProfile>
<activeProfile>snapshots-group</activeProfile>
<activeProfile>plugins</activeProfile>
</activeProfiles>
}
The tag <activeProfiles> can only be used in the settings.xml, not in the POM.
There are different possibilities to activate a profile which can be used in a POM:
https://maven.apache.org/guides/introduction/introduction-to-profiles.html

Where to get gwt-maven-plugin 2.8.0-SNAPSHOT

The gwt-maven-plugin documentation lists 2.8.0-SNAPSHOT as current version, and I'd like to evaluate the upcoming 2.8.0 GWT.
While version 2.7.0 is available directly from the Maven Central repository, I am unable to find the correct repository from which to retrieve the snapshot. Unfortunately I have been unable to find this information on the project's homepage.
Can anybody please provide me with a working <repository/> and <pluginRepository/> configuration to use in my pom.xml?
This worked for me:
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/google-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>snapshots-repo</id>
<!--<url>https://oss.sonatype.org/content/repositories/google-snapshots</url>-->
<url>https://oss.sonatype.org/content/repositories/public/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

Maven commands failing

I am trying to build a project using maven. I have a properties tag which has the following links in pom.xml-
<properties>
<release_deploy_repo>http://.../releases</release_deploy_repo>
<plugin_repo>http://.../public</plugin_repo>
<central_repo>http://.../public</central_repo>
</properties>
and then under repositories, i have
<repositories>
<repository>
<id>central</id>
<name>Central Repo</name>
<url>${central_repo}</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
when i try mvn clean install, i get this error -
${central_repo} not found. Any idea what i doing wrong?

What is this parent (jboss-parent) that the parent pom in Wildfly Quickstart is pointing to?

<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>14</version>
<relativePath />
</parent>
Where should this parent go, once I find it? Or is it safe to ignore?
It's located on GitHub and Maven central.
You might not need it however depending on what you're doing. It's used to just pull in some default plugin versions and dependency versions.
Copy the settings.xml file from $MAVEN_HOME/conf to local .m2 directory.
Edit and add:
inside <profiles> node:
<profile>
<id>jboss-public-repository</id>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
Below </profiles> node in <settings> node:
<activeProfiles>
<activeProfile>jboss-public-repository</activeProfile>
</activeProfiles>

artifactory local repo in maven project

I've setted artifactory in localhost (I'm trying on localhost before setting up my server), but when I use this repo in my maven project I can't retrieve my libs. Any suggestions?
Artifactory provides you with a small utility that generates a Maven settings file based on the repositories configured in Artifactory and your selections; assuming your repositories are properly configured, this utility normally does a good job.
Try (change id ClaudioStas to central):
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://localhost:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://localhost:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://localhost:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://localhost:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>

Resources