How can I setup multiple repositories for mvn builds? - maven

I want to download 'standard' jars like Spring framework from central maven repository, but proprietary license jars from our custom maven repository (Artifactory) repo. I've setup the pom.xml file this way:
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>maven2</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>2</id>
<name>Artifactory</name>
<url>https://na.artifactory.swg-devops.com/artifactory/gbs-ic2esprint-bluecost-libs-maven-virtual</url>
</repository>
</repositories>
It's not working the way I want it. Here is what I get now:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpreadSheetUploadWeb 1.0
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/1.9.10/jackson-databind-1.9.10.pom
[INFO] Downloading: https://na.artifactory.swg-devops.com/artifactory/gbs-ic2esprint-bluecost-libs-maven-virtual/com/fasterxml/jackson/core/jackson-databind/1.9.10/jackson-databind-1.9.10.pom
[INFO] Downloading: http://repo.spring.io/ext-release-local/com/fasterxml/jackson/core/jackson-databind/1.9.10/jackson-databind-1.9.10.pom
[INFO] Downloading: http://repo.spring.io/milestone/com/fasterxml/jackson/core/jackson-databind/1.9.10/jackson-databind-1.9.10.pom
[INFO] Downloading: http://repo.spring.io/snapshot/com/fasterxml/jackson/core/jackson-databind/1.9.10/jackson-databind-1.9.10.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-annotations/1.9.10/jackson-annotations-1.9.10.pom
[INFO] Downloading: https://na.artifactory.swg-devops.com/artifactory/gbs-ic2esprint-bluecost-libs-maven-virtual/com/fasterxml/jackson/core/jackson-annotations/1.9.10/jackson-annotations-1.9.10.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-core/1.9.10/jackson-core-1.9.10.pom
[INFO] Downloading: https://na.artifactory.swg-devops.com/artifactory/gbs-ic2esprint-bluecost-libs-maven-virtual/com/fasterxml/jackson/core/jackson-core/1.9.10/jackson-core-1.9.10.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/ibm/db2/jcc/db2jcc_license_cisuz/10.5.9/db2jcc_license_cisuz-10.5.9.pom
[INFO] Downloading: https://na.artifactory.swg-devops.com/artifactory/gbs-ic2esprint-bluecost-libs-maven-virtual/com/ibm/db2/jcc/db2jcc_license_cisuz/10.5.9/db2jcc_license_cisuz-10.5.9.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.403 s
[INFO] Finished at: 2018-05-04T07:47:47-06:00
[INFO] Final Memory: 17M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project SpreadSheetUploadWeb: Could not resolve dependencies for project SpreadSheetUploadWeb:SpreadSheetUploadWeb:jar:1.0: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.4.3.RELEASE -> org.springframework.boot:spring-boot-starter-web:jar:1.4.3.RELEASE -> com.fasterxml.jackson.core:jackson-databind:jar:1.9.10: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:1.9.10: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:1.9.10 from/to 2 (https://na.artifactory.swg-devops.com/artifactory/gbs-ic2esprint-bluecost-libs-maven-virtual): Access denied to https://na.artifactory.swg-devops.com/artifactory/gbs-ic2esprint-bluecost-libs-maven-virtual/com/fasterxml/jackson/core/jackson-databind/1.9.10/jackson-databind-1.9.10.pom. Error code 401, Unauthorized -> [Help 1]
[ERROR]

The tags do not affect the order at which maven uses repositories to fetch dependencies.
So the for maven central should be central, just for good practice.
However, your order is right but your links are not correct. you did not specify the central repository correctly. Try this instead:
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>maven2</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
For your artifactory, try with your browser if you can connect to https://swg-devops.com/artifactory . Try also with https://repo.maven.apache.org/maven2 and you should see how it should look like. When you have the correct link resolved you should be able to download the dependencies and maven automatically tries all the repositories from first to last to find the dependency.

Related

Unable to get *.tar.gz files from Nexus Repository

I'm tring to install Maven Wrapper and get "Error installing the Maven Wrapper.: Server returned HTTP response code: 401" from my Nexus Repository.
To reproduce the error I can just remove a local cache of Maven Wrapper and try to install it to an empty folder:
rm -R ~/.m2/repository/io/takari/maven-wrapper/0.5.6/
mvn -N io.takari:maven:wrapper -Dmaven=3.8.4
The output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven:0.7.7:wrapper (default-cli) # standalone-pom ---
Downloading from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.pom
Downloaded from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.pom (2.4 kB at 15 kB/s)
Downloading from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
Downloaded from nexus: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar (51 kB at 1.5 MB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.103 s
[INFO] Finished at: 2022-03-21T10:45:51+05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.takari:maven:0.7.7:wrapper (default-cli) on project standalone-pom: Error installing the Maven Wrapper.: Server returned HTTP response code: 401 for URL: http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.tar.gz -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
pom and jar files are downloaded just fine. The problem is with tar.gz file only.
Here is my settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings
xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>1</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<url>http://localhost:8081/repository/maven-public</url>
<mirrorOf>*</mirrorOf>
</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>
</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>
</settings>
The URL http://localhost:8081/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.tar.gz?describe is retrived just fine in a browser:
Code 200
Content-Type application/x-gzip
Size 51848
Error 401 is unauthorize error
Did you try to put an autologin config file in your user's home directory already?
Example: /Users/my_username/.netrc
machine nexus.somewhere.com
login correct_user
password correct_password
You also need to ensure the account is available and have valid permission to target lib

The desired archetype does not exist

When calling Maven to generate an archetype following the instructions at https://confluence.sakaiproject.org/display/BOOT/Sakai+Spring+MVC+Maven+Archetype, Maven complains about the archetype being inexistent, even though the file is located in the given archetype respository: https://source.sakaiproject.org/maven2/org/sakaiproject/maven-archetype/sakai-spring-maven-archetype/1.2/sakai-spring-maven-archetype-1.2.pom.
Maven version is:
>mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
This is what happens - it looks like the -DarchetypeRepository parameter is ignored:
> mvn archetype:generate -DarchetypeGroupId=org.sakaiproject.maven-archetype
-DarchetypeArtifactId=sakai-spring-maven-archetype
-DarchetypeVersion=1.2
-DarchetypeRepository=https://source.sakaiproject.org/maven2
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.1.2:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.1.2:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.1.2:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode
[WARNING] Archetype not found in any catalog. Falling back to central repository.
[WARNING] Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.
[WARNING] The POM for org.sakaiproject.maven-archetype:sakai-spring-maven-archetype:jar:1.2 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.395 s
[INFO] Finished at: 2020-01-11T12:24:20+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.sakaiproject.maven-archetype:sakai-spring-maven-archetype:1.2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Turns out that Maven 3 changed the way archetype repositories are integrated. The -DarchetypeRepository parameter is not there anymore. Instead, archteype repositories need to be added to settings.xml:
<profiles>
<profile>
<!-- the profile id is arbitrary -->
<id>sakai</id>
<repositories>
<repository>
<!-- the repository id has to be named: archetype -->
<id>archetype</id>
<name>Repository for Sakai archetypes</name>
<url>https://source.sakaiproject.org/maven2/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!-- The profile needs to be added to activeProfiles in order to be taken into account -->
<activeProfiles>
<activeProfile>sakai</activeProfile>
</activeProfiles>

maven deploy does not work for releases

Hi I am a beginner for maven build tool. I built a simple maven JavaEE project and I tried to build it remote nexus repository. But i can deploy successfully only for snapshots. Releases deploying gives 400 bad request error.
here is my Setting.xml configuration
<servers>
<server>
<id>****</id>
<username>****</username>
<password>****</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://******:8081/nexus/content/groups/net.******.timetrack/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>*****</id>
<url>http://******:8081/nexus/content/groups/net.*******.timetrack/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>******</id>
<url>http://******:8081/nexus/content/groups/net.******.timetrack/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
and here is my pom.xml's distribution management
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>*****</id>
<name>******</name>
<url>http://*******:8081/nexus/content/groups/net.******.timetrack/</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>*****</id>
<name>***** Snapshots</name>
<url>http://******:8081/nexus/content/repositories/snapshots/</url>
<layout>legacy</layout>
</snapshotRepository>
</distributionManagement>
If I run mvn clean deploy with (for a snapshot)
<groupId>net.*****.*****</groupId>
<artifactId>*****-**-****</artifactId>
<version>1.4-SNAPSHOT</version>
<packaging>war</packaging>
then successfully deploy in to nexus repository snapshot directory.
If it I run mvn clean deploy with (for a release)
<groupId>net.*****.****</groupId>
<artifactId>****-***-*****</artifactId>
<version>1.4.1</version>
<packaging>war</packaging>
then it gives 400-bad request error
Here is the log for the error
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) # ****-****-***** ---
[INFO] Packaging webapp
[INFO] Assembling webapp [*****-time-tracker] in [/home/dilanka/Projects/time_tracker/samples/GitLab/****/***-time-tracker/target/*****-time-tracker-1.4]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/dilanka/Projects/time_tracker/samples/GitLab/*****/****-time-tracker/src/main/webapp]
[INFO] Webapp assembled in [115 msecs]
[INFO] Building war: /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/*****-time-tracker/target/****-time-tracker-1.4.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # ****-time-tracker ---
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/target/****-time-tracker-1.4.war to /home/dilanka/maven3-repo/net/*****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.war
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/pom.xml to /home/dilanka/maven3-repo/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # ****-time-tracker ---
Uploading: http://*****:8081/nexus/content/groups/net.*****.timetrack/net/****s/timetrack/***-time-tracker/1.4/****-time-tracker-1.4.war
Uploading: http://*****:8081/nexus/content/groups/net.****.timetrack/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.790 s
[INFO] Finished at: 2016-01-08T15:28:08+05:30
[INFO] Final Memory: 32M/252M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ****-time-tracker: Failed to deploy artifacts: Could not transfer artifact net.****.timetrack:*****-time-tracker:war:1.4 from/to ***** (http://*****:8081/nexus/content/groups/net.****.timetrack/): Failed to transfer file: http://*****:8081/nexus/content/groups/net.****.timetrack/net/*****/timetrack/*****-time-tracker/1.4/****-time-tracker-1.4.war. Return code is: 400, ReasonPhrase: Bad Request. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
If any body please help me to solve this problem.
Thanks.
You can deploy a release version of a given artifact exactly once to a given Nexus instance.
If the same version already exists in your Nexus, you'll get an error like the one you're seeing.
<url>http://*******:8081/nexus/content/groups/net.****.timetrack/</url>
You can't deploy into a group repository, change this URL to be the URL of a hosted release repository.

Maven - Can't deploy to remote repository

I'm trying to deploy my library to my own remote maven repository. I'm using NetBeans 8
Here's my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.my.company.library.name</groupId>
<artifactId>LibraryId</artifactId>
<version>3.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
(... my dependencies...)
</dependencies>
<distributionManagement>
<repository>
<id>myServer</id>
<name>myServer Repository</name>
<url>http://maven.mycompany.com</url>
</repository>
</distributionManagement>
</project>
And here is my settings.xml
<?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">
<servers>
<server>
<username>dwnz</username>
<id>central</id>
</server>
<server>
<id>myServer</id>
<username>dwnz</username>
<password>mySuperSecretPassword</password>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://maven.mycompany.com/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://maven.mycompany.com/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://maven.mycompany.com/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://maven.mycompany.com/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
When I do Clean and Build I get the following ouput on NetBeans:
cd /Users/dwnz/Development/Server/code/project/myLibrary; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/java/maven/bin/mvn" clean install
Scanning for projects...
------------------------------------------------------------------------
Building library 3.0
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # library ---
Deleting /Users/dwnz/Development/Server/code/project/myLibrary/target
--- maven-resources-plugin:2.5:resources (default-resources) # myLibrary ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 0 resource
--- maven-compiler-plugin:2.3.2:compile (default-compile) # myLibrary ---
Compiling 183 source files to /Users/dwnz/Development/Server/code/project/myLibrary/target/classes
--- maven-resources-plugin:2.5:testResources (default-testResources) # myLibrary ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory /Users/dwnz/Development/Server/code/project/myLibrary/src/test/resources
--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # myLibrary ---
No sources to compile
--- maven-surefire-plugin:2.10:test (default-test) # myLibrary ---
No tests to run.
Surefire report directory: /Users/dwnz/Development/Server/code/project/myLibrary/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
--- maven-jar-plugin:2.3.2:jar (default-jar) # myLibrary ---
Building jar: /Users/dwnz/Development/Server/code/project/myLibrary/target/library-3.0.jar
--- maven-install-plugin:2.3.1:install (default-install) # myLibrary ---
Installing /Users/dwnz/Development/Server/code/project/myLibrary/target/library-3.0.jar to /Users/dwnz/.m2/repository/com/myCompany/project/server/myLibrary/library/3.0/library-3.0.jar
Installing /Users/dwnz/Development/Server/code/project/myLibrary/pom.xml to /Users/dwnz/.m2/repository/com/myCompany/project/server/myLibrary/library/3.0/library-3.0.pom
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 3.426s
Finished at: Mon May 11 17:16:22 WEST 2015
Final Memory: 18M/220M
------------------------------------------------------------------------
On my server I'm using Artifactory.
On my remote maven repository my library is not deployed. Any one knows or can spot what am I doing wrong here and why it is not deploying on my remote maven repository?
------ EDIT-------
I just tried using the mvn deploy on the command line still to no success. Here is the ouput from the command line:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myLibrary 3.0
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.myserver.com/plugins-release/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
Downloading: http://maven.myserver.com/plugins-snapshot/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.119 s
[INFO] Finished at: 2015-05-11T18:22:35+01:00
[INFO] Final Memory: 8M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (http://maven.myserver.com/plugins-release): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Apparently it is trying to download some plugins from my remote server. I'm not the admin of that server so I can't get access to it, I just have an account there.
As pointed out by khmarbaise it was a server misconfiguration.

maven release:prepare with artifactory deploy substep fails

after researching now for days and close to suicidal tendencies here my problem and really really hope that i was too stupid to find the problem by myself ....
setup: windows7 / maven 3.2.3 / jdk 1.7.0_60 (64bit) / artifactory 3.5.0
Problem:
- mvn clean install deploy --> works
- mvn release:prepare --> works
- mvn release:perform fails in substep deploy (which works standalone as mentioned before)
- POM.XML and settings.xml (for testing i took the pregenerated one from artifactory) for me. but i attached them further down....
thnx in advance for ANY help!
cheers
j.
log:
.....
[INFO] [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # apps.hr ---
[INFO] Uploading: http://vm-local-repo.fernbach-lu.dom:8081/artifactory/libs-release-local/com/fernbach/apps.hr/0.1.4/apps.hr-0.1.4.war
[INFO] 2/75918 KB
[INFO] 4/75918 KB
[INFO] 6/75918 KB
[INFO] 8/75918 KB
....
[INFO] 60/75918 KB
[INFO] Apr 01, 2015 4:56:30 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[INFO] 62/75918 KB
[INFO] INFO: I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] 64/75918 KB
[INFO] Apr 01, 2015 4:56:30 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[INFO] INFO: Retrying request
[INFO] 66/75918 KB
[INFO] Apr 01, 2015 4:56:30 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[INFO] 68/75918 KB
.....
.....
[INFO] 390/75918 KB
[INFO] 392/75918 KB
[INFO]
[INFO] Uploading: http://vm-local-repo.fernbach-lu.dom:8081/artifactory/libs-release-local/com/fernbach/apps.hr/0.1.4/apps.hr-0.1.4.pom
[INFO] 2/2 KB
[INFO]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 23.043 s
[INFO] [INFO] Finished at: 2015-04-01T16:56:30+02:00
[INFO] [INFO] Final Memory: 47M/366M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project apps.hr: Failed to
deploy artifacts: Could not transfer artifact com.fernbach:apps.hr:war:0.1.4 from/to fs-releases (http://vm-local-repo.fernbach-lu.dom:8081
/artifactory/libs-release-local): Connection reset by peer: socket write error -> [Help 1]
...
SETTINGS.XML
?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">
<localRepository>d:/fr4/maven/repo</localRepository>
<servers>
<server>
<username>jus</username>
<password>AP6XtRyuPNMVbXfnzP9BopSDp66</password>
<id>central</id>
</server>
<server>
<username>jus</username>
<password>AP6XtRyuPNMVbXfnzP9BopSDp66</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://vm-local-repo:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://vm-local-repo:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://vm-local-repo:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://vm-local-repo:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
POM.XML
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<parent>
<groupId>com.fernbach</groupId>
<artifactId>fernbach.parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>apps.hr</artifactId>
<version>0.1.5-SNAPSHOT</version>
<packaging>war</packaging>
<name>HR</name>
<properties>
<foundation.version>1.0.0</foundation.version>
</properties>
<dependencies>
<dependency>
<groupId>com.fernbach</groupId>
<artifactId>foundation.core</artifactId>
<version>${foundation.version}</version>
</dependency>
<dependency>
<groupId>com.fernbach</groupId>
<artifactId>foundation.web</artifactId>
<version>${foundation.version}</version>
</dependency>
</dependencies>
<scm>
<developerConnection>scm:svn:http://vm-uranus1.fernbach-lu.dom/svn/fernbach-R4/apps/hr/branches/BRANCH_0.1.1</developerConnection>
<url>scm:svn:http://vm-uranus1.fernbach-lu.dom/svn/fernbach-R4/apps/hr/branches/BRANCH_0.1.1</url>
</scm>
</project>
I finally found a solution in a comment of a Maven Bug that had been reported for version 3.2.3.
Here's the bug: https://issues.apache.org/jira/browse/MNG-5684
The problem is the maven-source-plugin which is used to attach source jars to the project. More exactly it's the no-fork goals that cause this behavior. Using these goals the deploy plugin tries to upload the source jars twice which fails due to repository restrictions.
The solution can either be omitting the source-plugin (but then you won't have attached sources anymore) or using the forked goals (jar and test-jar) instead.
I now use the forked goals with maven 3.3.3 and I'm able to release projects again.

Resources