Artifactory OSS throwing 405 Exception when running maven release:perform - maven

artifactory-oss-6.7.2 is throwing a 405 status code exception when running maven release:perform
Created a settings.xml from artifactory "generate settings.xml" on repo. All repos are virtual repos. Added distributionManagement to my project pom file to use the ids for snapshots and releases from settings.xml.
settings.xml:
<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>
myproject/pom.xml:
<distributionManagement>
<repository>
<id>central</id>
<name>Artifactory Release Repo</name>
<url>http://localhost:8081/artifactory/libs-release</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Artifactory Snapshot Repo</name>
<url>http://localhost:8081/artifactory/libs-snapshot</url>
</snapshotRepository>
</distributionManagement>
run mvn release:perform output:
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project model: Failed to deploy artifacts: Could not transfer artifact com.test:model:jar:0.1.0 from/to central (http://localhost:8081/artifactory/libs-release): Failed to transfer file http://localhost:8081/artifactory/libs-release/com/srcrea/model/0.1.0/model-0.1.0.jar with status code 405 -> [Help 1]

So I followed something I found here -> http://forums.jfrog.org/Error-Code-405-with-mvn-deploy-td7174367.html
And updated DistributionManagement of the pom.xml
<distributionManagement>
<repository>
<id>central</id>
<name>Artifactory Release Repo</name>
<url>http://localhost:8081/artifactory/88888</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Artifactory Snapshot Repo</name>
<url>http://localhost:8081/artifactory/88888</url>
</snapshotRepository>
</distributionManagement>
Re-Run and now I see it:
But what is not clear is in order to generate settings.xml you need to associate virtual repos to a local repo. Then generate settings off that and use the distributionManagement configuration to point back to the local repo. What is the point of the virtual repo?

Related

How to prevent Maven from downloading artifacts from repository when I just update the pom version of my project

I'm using Maven as CI and JFrog Artifactory as a repository of my own artifacts and as a cache. Everything works fine. I'm using the Artifactory plugin in Jenkins to trigger artifact download and upload.
I cannot figure how to handle the following use case.
I have a multi-module project. In my Settings.xml I defined some snapshot, plugin, and release repositories.
In my local workspace, I upgraded the pom version of the parent project and its children. Then I made a local clean install. It failed because Maven was trying to download the artifacts of my project from Artifactory and they don't exist of course because I'm trying to create a new version of the project.
How to handle this use case? How to configure my pom or settings to do?
How to do this in the Artifactory plugin in Jenkins in a freestyle way?
I have error messages like this :
10:23:28 Failed to transfer Could not find metadata com.xxx.xxxx.xxx:my-parent-project:3.0.0-SNAPSHOT/maven-metadata.xml in xxx
10:23:50 [FATAL] Non-resolvable parent POM for com.xxx.xxxx.xxx:subpoject1:[unknown-version]: Could not find artifact .....and 'parent.relativePath' points at wrong local POM # line 7, column 10*
=====================================
pom configuration of the parent pom
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.xxx.xxx</groupId>
<artifactId>my-parent-project</artifactId>
<version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../subproject-1</module>
<module>../subproject-2</module>
</modules>
==================================
pom configuration for subproject1
<artifactId>subproject-1</artifactId>
<parent>
<groupId>com.xxx.xxx.xxx</groupId>
<artifactId>my-parent-project</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
======================================
Here is my settings.xml configuration
<profile>
<id>artifactory_profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/libs-snapshot</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>sing</id>
<name>sing-virtual-repo</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/virtual-repo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-release</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
</profile>
If you run clean install on the parent POM, then everything will be created correctly.

How to connect mule repository?

I'm getting below when i run my mule interface.
[ERROR] Failed to execute goal on project apl-integration: Could not resolve dependencies for project com.katalystm:apl-integration:mule:1.0.0-PRE: Failed to collect dependencies at com.mulesoft.muleesb:mule-core-ee:jar:3.7.0: Failed to read artifact descriptor for com.mulesoft.muleesb:mule-core-ee:jar:3.7.0:
Could not transfer artifact com.mulesoft.muleesb:mule-core-ee:pom:3.7.0 from/to mulesoft-releases (http://repository.mulesoft.org/releases/): Connect to repository.mulesoft.org:80 [repository.mulesoft.org/52.7.200.18] failed: Connection timed out: connect -> [Help 1]
Seem it is failed to connect the http://repository.mulesoft.org/releases/, i have added the repository even in my POM file aslo.
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshots Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
</repositories>
Please add this repository
<repository>
<id>codehaus-mule-repo</id>
<name>codehaus-mule-repo</name>
<url>
https://repository-master.mulesoft.org/nexus/content/groups/public/
</url>
<layout>default</layout>
</repository>

Error building with Service Now connector v5.0.0 for Mule 3.7.1

I've been trying to do some tests with the new ServiceNow connector and Mule 3.7.1 but when I try to build the project and run it, it fails with the following error:
Failed to execute goal on project xxx: Could not resolve dependencies for project xxx:mule:0.0.1-SNAPSHOT: Failed to collect dependencies at org.mule.modules:mule-module-servicenow:jar:5.0.0: Failed to read artifact descriptor for org.mule.modules:mule-module-servicenow:jar:5.0.0: Could not transfer artifact org.mule.modules:mule-module-servicenow:pom:5.0.0 from/to mule-ee-releases (https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee/): 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/DependencyResolutionException
I believe I have added the correct information into the correct sections in pom.xml
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-servicenow</artifactId>
</inclusion>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-servicenow</artifactId>
<version>5.0.0</version>
</dependency>
<repository>
<id>mulesoft-releases1</id>
<name>MuleSoft Repository</name>
<url>http://repository-master.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots1</id>
<name>MuleSoft Snapshot Repository</name>
<url>http://repository-master.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
I had to change the id of the two new repositories, since my pom already had repositories of those id's.
Can anyone shed any light on this for me?
Do you have the EE maven credentials set settings.xml? I was able to build an empty application using mule-module-servicenow with the following auto-generated (by dragging the connector from Anypoint pallet onto canvas) repositories:
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshots Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
<repository>
<id>mule-ee-releases</id>
<name>MuleEE Releases Repository</name>
<url>https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-release</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>http://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

Why is Maven downloading from the wrong repository?

I'm a newbie to Maven. I'm trying to setup a local Archiva 1.3.6 server to act as a repository server for a project's internal artifact, as well as mirror to external repos. Things work fine except for snapshots. I'm using Maven version 3.0.5.
Here are the mirror settings in my settings.xml file
<mirrors>
<mirror>
<id>internal</id>
<mirrorOf>external:*</mirrorOf>
<name>My Maven Repository</name>
<url>http://my.repo.server:9000/archiva/repository/internal/</url>
</mirror>
</mirrors>
During the build, Maven tries to download the snapshot artifact from the wrong repository. I have 2 repositories set in the parent's parent pom.xml: internal and snapshots.
<repositories>
<repository>
<id>internal</id>
<url>http://my.repo.server:9000/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://my.repo.server:9000/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
In the project's pom.xml I have the following dependency:
<dependency>
<groupId>com.mygroup</groupId>
<artifactId>metadata-framework</artifactId>
<version>1.0.3.SNAPSHOT</version>
</dependency>
During the build Maven tries to do this:
Downloading:
.../archiva/repository/**snapshots**/com/mygroup/metadata-framework/1.0.3.SNAPSHOT/maven-metadata.xml
Downloaded:
.../archiva/repository/**snapshots**/com/mygroup/metadata-framework/1.0.3.SNAPSHOT/maven-metadata.xml (795 B at 16.9 KB/sec)
Downloading:
.../archiva/repository/**internal**/com/mygroup/metadata-framework/1.0.3.20130908.081541-1/cems-metadata-framework-1.0.3.20130908.081541-1.pom
[WARNING] The POM for com.myground:metadata-framework:jar:1.0.3.20130908.081541-1 is missing, no dependen
cy information available
I verified the files in snapshot repo is correct, that it has properly generated maven-metadata.xml and etc. it appears that Maven downloaded the metadata correctly from snapshot repo, determined the right timestamped version, but somehow it decided to download the actual file from internal repo instead of snapshots, which lead to 404 and failed build.
I have no idea how Maven works, please help.
#lee - Here's how I download custom artifacts from an internal snapshots repo within Archiva. I use this config every day.
settingsl.xml:
Let's say I have a virtual repo named "help".
help is comprised of outside-facing repos and 2 internal-facing repos. Those 2 internal-facing repos are:
help-internal
help-snapshots
Under the <mirrors> section, I declare:
<mirror>
<id>help</id>
<mirrorOf>*, !help-snapshots</mirrorOf>
<name>The Help Repository</name>
<url>http://blah:8080/archiva/repository/help/</url>
</mirror>
Under the <servers> section, I declare:
<server>
<id>help</id>
<username>my_user_name</username>
<password>{my_encrypted_pwd}</password>
</server>
<server>
<id>help-snapshots</id>
<username>my_user_name</username>
<password>{my_encrypted_pwd}</password>
</server>
And now the final bit. In my projects' pom's that use in-house snapshots, I include this:
<repositories>
<repository>
<id>help-snapshots</id>
<url>http://blah:8080/archiva/repository/help-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
More concisely, and without modifying any pom.xml, you could define an all repository group in archiva which contains both internal and snapshots, and then add the following in your .m2/settings.xml:
<mirrors>
<mirror><id>myGroup</id><mirrorOf>*</mirrorOf>
<url>http://my.repo.server:9000/archiva/repository/all/</url>
</mirror>
</mirrors>
<profiles>
<profile><id>alwaysactive</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository><id>unused</id><url>unused</url></repository>
</repositories>
</profile>
<profiles>
I know this post is old by in order for maven to search in a snapshot repository the version should end with "-SNAPSHOT" (rather than ".SNAPSHOT")

Maven. Repository authentication

I tried setup deploy to local repository:
-- settings.xml --
<server>
<id>myrepo</id>
<username>deployer</username>
<password>123456</password>
</server>
-- pom.xml ---
<repositories>
<repository>
<id>myrepo</id>
<url>http://myserver.com/artifactory/libs-release-local</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
when I execute "mvn deploy" I got error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.4:
deploy (default-deploy) on project xxx: Failed to deploy artifacts: Co
uld not transfer artifact xxx:xxx:war:0.1-20130527.121430-3 from/to myserver.com
(http://myserver.com:8083/artifactory/libs-snapshot-local): Failed to transfer file:
http://myserver.com:8083/artifactory/libs-snapshot-local/xxx/0.1-SNAPSHOT
/xxx-0.1-20130527.121430-3.war. Return code is: 401
Artifactory log:
2013-05-27 16:14:38,158 [DENIED DEPLOY] libs-snapshot-local:xxx/0.1-SNAPSHOT
/xxx-0.1-20130527.121430-3.pom for anonymous/192.168.6.36.
If I change server/repository id to "myserver.com" - deploy WORK!
But it does not suit me because that did not work plugin changelog with svn at myserver.com
I tried to add tags "profile" and "mirror" to server.xml and "distributionManagement" to pom.xml - getting the same error
server/repository id must be named ONLY as my server?
UPDATE1:
I remove tag 'repositories' from pom.xml and added tag 'distributionManagment':
--- pom.xml ---
<distributionManagement>
<repository>
<id>myrepo</id>
<name>myrepo</name>
<url>http://myserver.com/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>myrepo</id>
<name>myrepo</name>
<url>http://myserver.com/artifactory/libs-snapshots-local</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
(server.xml has not changed) - getting the same error "Failed to deploy..."
UPDATE2:
Try...
--- server.xml ---
<profiles>
<profile>
<id>artifactory</id>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://myserver.com/artifactory/libs-release-local</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://myserver.com/artifactory/libs-snapshot-local</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
<server>
<id>snapshots</id>
<username>deployer</username>
<password>123456</password>
</server>
<server>
<id>central</id>
<username>deployer</username>
<password>123456</password>
</server>
--- pom.xml ---
<distributionManagement>
<repository>
<id>central</id>
<name>Internal Releases</name>
<url>http://myserver.com/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>http://myserver.com/artifactory/libs-snapshots-local</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
execute 'mvn deploy' - again error :(
Failed to deploy artifacts: Could not transfer artifact xxx:xxx:war:0.1-20130528.050526-1 from/to snapshots (http://myserver.com/artifactory/libs-snapshots-local)
The 'repositories' tag is used for resolution, not for deployment. I'd speculate that the id of the repository under 'distributionManagment' tag is 'myserver.com', that's why it matches the server declaration in settings.xml
You settings.xml is missing the <servers> </servers> tags around your two <server> nodes. - https://maven.apache.org/settings.html#Servers
Also, I would avoid using generic id's like 'snapshots' and 'central'. Understandable if they are there for the purpose of SO.
The last update to this question didn't include the specific error code, but in the original error it was a 401 (Unauthorized) which leads me to believe that it's not able to find your servers authentication information due to invalid settings.xml

Resources