promotion artifact repository from Snapshot to Release in Nexus - maven

I am trying to promote artifact repository from Snapshot to Release in Nexus using Single artifact uploader in Jenkins . But this is not working for me.
Getting error like :
Could not resolve artifact: Could not find artifact
Snapshots.net.iin:snapshots:jar:0.0.1-SNAPSHOT in stagingrepo.
And I check from configuring the staging suite and got to know that Staging is part of the Nexus Repository Manager Pro.
I am using Nexus version - Nexus Repository Manager OSS 2.14.8-01.
I wanted to promote these snapshot artifacts to Release .So what's the best way to take this forward?

Related

Build on jenkins and sonatype maven giving me a bad request

When I try to build a maven artifact with Jenkins the build output says the following:
I had already a bunch of successful builds on version 1.0.
I'm using CentOS and Nexus 3 OSS.
400 Bad Request will be returned if you attempt to:
Deploy a snapshot artifact (or version) ending in -SNAPSHOT to a release repository
Deploy a release artifact (version not ending in -SNAPSHOT) to a snapshot repository
Also check: Error when deploying an artifact in Nexus

Publishing SNAPSHOT to nexus from jenkins/maven build

I'm trying to publish the result of a build jenkins/maven to a Nexus repository.
The build is a war SNAPSHOT, here is the beginning of the POM :
<http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.elis</groupIenter code hered>
<artifactId>accueil_ce</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>accueil_ce</name>
I use clean install maven goals for the build.
I've installed and configure the Nexus Repository Manager Publisher plugin for jenkins so it can publish to my nexus Repo in a post build step.
The problem is :
if I configure the repo as 'snapshot' and 'allow redeploy' in Nexus, it doesnt appear in the list of repos available in Jenkins, when configuring the after build step 'Nexus Repository Manager Publisher' of the job.
if I configure the repos as 'release' and 'allow redeploy' in Nexus, then I got the following error when running the jenkins job :
java.io.IOException:com.sonatype.nexus.api.exception.RepositoryManagerException: Unable to upload component: Bad Request The version 0.0.1-SNAPSHOT does not match the repository policy!
I don't understand, there is no way to publish SNAPSHOTs to nexus from jenkins builds with this plugin ??
You need to add distribution management to you pom to control snapshot and release repos.
See https://maven.apache.org/pom.html#Distribution_Management and How to configure maven project to deploy both snapshot and releases to Nexus?

Releasing an artifact in staging repository

I've deployed a maven artifact to ossrh. It is now in a staging repository (https://oss.sonatype.org/content/repositories/central_bundles-7996)
How can I release this artifact ? Trying via mvn nexus-staging:release or from webapp on oss.sonatype.org, I get a 403 : unauthorized...
I must create a issue of type "New Project" in http://issues.sonatype.org/
Then when the project wil be created, confirm on the issue that everything is correct, and that the artifact can be released.
You have to manually go to the oss nexus and release it.
Close and Drop or Release Your Staging Repository
Once you have successfully closed the staging repository, you can release it by pressing the Release button. This will move the components into the release repository of OSSRH where it will be synced to the Central Repository.

How to deploy my project to Maven's Central Repository when it's already in Sonatype repository

I have followed the guide of http://jroller.com/holy/entry/releasing_a_project_to_maven, and deployed my project into sonatype release repository successfully.
You can see my project in https://oss.sonatype.org/content/repositories/releases.
But I still can't find my project in Maven's Central Repository. And not everyone's nexus has config sonatype release repo , but I'm very sure everyone has Maven central repository.
So who can tell me how to let Maven central repo collect my project?
What should I need to do now?
Did you read and follow step 6 in the description you link to:
When the artifacts are in the release repository, add a comment to the
original ticket asking for them to be published to Maven Central. For
the first time they need to do it manually but since that on it will
be synchronized automatically every hour

maven could not resolve dependency via my local nexus repository

I have setup an in-house Sonatype Nexus repository and configure the maven to check my local Nexus instead of getting artifacts directly from public repositories.
http://www.sonatype.com/books/nexus-book/reference/config-sect-intro.html
Our project was able to download the most artifacts except one artifact in Maven central.
Here is the build error:
Failed to execute goal on project shindig-gadgets: Could not resolve dependencies for project org.apache.shindig:shindig-gadgets:jar:3.0.0-SNAPSHOT: Could not find artifact com.ibm.icu:icu4j:jar:4.6 in nexus (http://my_nexus_repository:8081/nexus/content/groups/public) -> [Help 1]
I see that icu4j-4.6.jar does exist in the Maven central repository. On my local nexus repository, it doesn't exist. I see only icu4j-4.6.pom exists on my local nexus repository.
It's not like my nexus repository setting is totally broken. maven project has successfully downloaded numerous jar files from multiple public repositories via my local nexus maven repository except icu4j-4.6.jar.
I don't understand why I'm having a problem with only icu4j-4.6.jar. Would it be incorrectly cached on either my local maven or nexus maven repository?
If it was incorrectly cached, how can I clean the local maven or nexus maven repository?
The similar problem is described at
Missing maven dependency using nexus setup
icu4j-4.6.jar does not show up in the search list. Only icu4j-4.6.pom shows up in the search list. I don't think is Snapshot VS Release issue because icu4j-4.6.jar seems release jar.
Is it possible that the nexus repo just stopped responding for a while? You can try mvn -X (or -d?) to get detailed info about what is going on. You might also try configuring an alternative repo.
Perhaps you haven't enabled remote index downloads from Maven Central. This would explain why only the POM file appears in your local search (The only file which has been downloaded via the proxy repo).
There might be another issue causing the download failure for the jar itself.... I suppose try and solve one problem at a time :-)
Try adding -U to your mvn arguments to force an update of your local repository.
You could also have corrupt meta data in the repo. In which case, delete that artifact from the repo's cache and let it refresh.
If the artifact in question was cached in properly from the proxy repository, using mvn -U will fix the problem
However if you are seeing pom on your nexus ,this usually happens when the artifact from the proxy repository is not cached in properly. The way to fix is
1) Browse to the component in the Proxy Repository.
2) Invalidate the cache for the repository and reindex the Nexus repository.
3) run mvn clean -U

Resources