Maven commands failing - maven

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?

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

Jenkins maven release goes to lib-snapshot repository

I am having setup where Jenkins is used to release maven project to artifactory. I see everything is working fine what maven release do like incrementing pom versions, creating tag but it is not uploading to lib-release repo instead it is uploading it to lib-snapshot repo.
I verified my settings.xml and saw it uses different ids for snapshot and release repo. What else can I check to fix this issue?
This is my settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--<settings.version>1.0.1</settings.version>-->
<!--<settings.region>IL</settings.region>-->
<!--<settings.type>server</settings.type>-->
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<id>artifactory_server</id>
<username>deploy_user</username>
<password>xxxxxxxxxxxxxxxxxxx</password>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots />
<releases>
<enabled>false</enabled>
</releases>
<id>artifactory-snapshots</id>
<name>libs-snapshot</name>
<url>http://artifactory.example.com/artifactory/libs-snapshot</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>artifactory-release</id>
<name>libs-release</name>
<url>http://artifactory.example.com/artifactory/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
<id>central</id>
<name>plugins-release</name>
<url>http://artifactory.example.com/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://artifactory.example.com/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
It's completely up to Maven and POM definitions.
By default every Jenkins run are threaten as Snapshots but you can control them by
Repositories with
<snapshots>
<enabled>false</enabled>
</snapshots>
And using maven-release-plugin https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html

Why does the jira try to download dependencies from different sources

I have a jira trying to download dependencies from the server. I have a repository that is configured and works great. This repository duplicates data from the server (in fact it is a secure gateway).
BUT somehow jira tries to connect directly to the server, at the same time it refers to the repository: 3
I thought that in jira connection with the network and with the Internet is configured in maven. Maybe I'm wrong ?
here are the settings of the mavena setting.xml lying in (atlassian-plugin-sdk-6.2.14 \ apache-maven-3.2.1 \ conf)
<?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>
<id>maven-public</id>
<url>http://n7701-sys274:8081/artifactory/maven-public</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>maven-external</id>
<url>http://n7701-sys274:8081/artifactory/maven-external</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>maven2</id>
<url>http://n7701-sys274:8081/artifactory/maven2/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>public</id>
<url>http://n7701-sys274:8081/artifactory/public/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<url>http://n7701-sys274:8081/artifactory/public/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>maven2</id>
<url>http://n7701-sys274:8081/artifactory/maven2/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>maven-external</id>
<url>http://n7701-sys274:8081/artifactory/maven-external</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>maven-public</id>
<url>http://n7701-sys274:8081/artifactory/maven-public</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
Unless I am mistaken your problem is that:
you properly configure maven to retrieve artifacts from your artifactory server
maven downloads a batch of artifacts from artifactory and resolves them
maven then tries to download transitive dependencies from maven central
Maven central is a special pre-configured repository, injected through automatic POM inheritance.
So your artifacts are resolved both in the repositories defined in your own settings.xml and in maven central
In a nutshell, you need to define in your settings.xml that your artifactory server acts as a mirror to maven central, with the following snippet
...
<mirrors>
<mirror>
<id>central-proxy</id>
<name>Artifactory proxy of central repo</name>
<url>http://n7701-sys274:8081/artifactory/maven-public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
...
Note that closely related to this question is Disable Maven central repository
My answer is a combination of the solutions to this question.

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>

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>

Resources