Releasing to Maven Central - maven

I was added as a developer to the Maven project and now I need to make a release.
I've added nexus-staging-maven-plugin to pom.xml file.
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
Also I've added distributionManagement to pom.xml
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
I've placed my credentials to ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>ossrh</id>
<username>divanov-oss.sonatype.org-account</username>
<password>divanov-oss.sonatype.org-password</password>
</server>
</servers>
</settings>
I also tried to create and use "Access User Token" on oss.sonatype.org
as my credentials.
Now I'm executing to deploy release into maven central.
mvn clean deploy
which ends up in the error:
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.3:deploy
(injected-nexus-deploy) on project project: Failed to deploy artifacts:
Could not transfer artifact
project:jar:4.4.0-20141228.104011-1 from/to ossrh
(https://oss.sonatype.org/content/repositories/snapshots): Access denied to:
https://oss.sonatype.org/content/repositories/snapshots/project/project/4.4.0-SNAPSHOT/project-4.4.0-20141228.104011-1.jar,
ReasonPhrase: Forbidden. -> [Help 1]
or
[INFO] Performing remote staging...
[INFO]
[INFO] * Remote staging into staging profile ID "329a0bc2b7ce06"
[ERROR] Remote staging finished with a failure: 403 - Forbidden
[ERROR]
[ERROR] Possible causes of 403 Forbidden:
[ERROR] * you have no permissions to stage against profile with ID "329a0bc2b7ce06"? Get to Nexus admin...
How can I check my access rights within Maven project I'm trying to release?

Your credentials are likely fine, you'd be getting a 401 error if they weren't. You're getting 403 (forbidden). This means the credentials were accepted, but you don't have permission to publish the artifacts. The most common cause of this is that you are using a different Maven group ID than the one assigned to you. File an issue at https://issues.sonatype.org in the "Community Support - Open Source Project Repository Hosting" and we'll get this worked out.

The credentials that you need to use shouldn't be of Sonatype JIRA, but of oss.sonatype.org. You need to register there separately.
[Update] The question was changed, so this answer is not relevant anymore. I'll keep it, since it's a common mistake.

Related

Push docker image to Nexus

Hello I have Jenkins and Nexus on the same server. When Jenkins build project correctly, i want push image to Nexus 3, but every time i have the same problem (log below).
Configuration:
pom.xml
<nexus.url>http://adress/#browse/browse/components:docker-image</nexus.url>
<distributionManagement>
<snapshotRepository>
<id>nexus</id>
<url>${nexus.url}</url>
</snapshotRepository>
</distributionManagement>
...
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.4</version>
<extensions>true</extensions>
<configuration>
<serverId>nexus</serverId>
<nexusUrl>${nexus.url}</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
And i have file settings.xml:
<servers>
<server>
<id>nexus</id>
<username>login</username>
<password>password</password>
</server>
</servers>
Then i try "mvn clean deploy" and result is:
[INFO] Deploying remotely...
[INFO] Bulk deploying locally gathered artifacts from directory:
[INFO] * Bulk deploying locally gathered snapshot artifacts to URL http://adress/repository/image-docker/
Downloading: http://adress/repository/image-docker/someProject/0.1-SNAPSHOT/maven-metadata.xml
Uploading: http://adress/repository/image-docker/someProject/0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.jar
Uploading: http://adress/repository/image-docker/someProject//0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:58 min
[INFO] Finished at: 2016-12-13T10:30:35+01:00
[INFO] Final Memory: 75M/748M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.4:deploy (injected-nexus-deploy) on project someProject:
Failed to deploy artifacts: Could not transfer artifact someProject:jar:0.1-20161213.093022-1 from/to nexus (http://adress/repository/image-docker/):
Failed to transfer file: http://adress/repository/image-docker/someProject/someProject/0.1-SNAPSHOT/someProject-0.1-20161213.093022-1.jar.
Return code is: 502, ReasonPhrase: Bad Gateway. -> [Help 1]
Every time is the same problem with 502 - Bad Gateway.
Do you have some proposal?
Unfortunately this will not work for a few reasons.
The URL you are using as a Nexus url is wrong, that URL is the browser URL. You need to use something more akin to https://nexusurl:portofdockerhostedrepo/repository/nameofdockerhostedrepo. You can get more information on setting up and pushing Docker images here: https://books.sonatype.com/nexus-book/reference3/docker.html#docker-push
Unless I'm completely wrong, mvn deploy is primarily for deploying maven artifacts into Maven repositories. I don't think this will work if you are attempting to deploy a Docker image. You might take a look at using something like this: https://github.com/spotify/docker-maven-plugin
Hope this helps.

Maven / SVN: cannot release:prepare -> commit failed when not passing -Dusername and -Dpassword

I don't know what's wrong here. When I execute release:prepare I get this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project myproject: Unable to commit files
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: E215004: Authentication failed and interactive prompting is disabled; see the --force-interactive option
[ERROR] svn: E215004: Commit failed (details follow):
[ERROR] svn: E215004: Unable to connect to a repository at URL 'https://localhost/svn/repo/myrepo/myapp/trunk/com.mydomain.mygame-TRUNK'
[ERROR] svn: E215004: No more credentials or we tried too many times.
[ERROR] Authentication failed
[ERROR] -> [Help 1]
The user and password, defined in settings.xml will be recognized by Maven, checked by....
$ mvn help:effective-settings
I can even connect to the repository by svn command. User and password is also correct.
When I execute with this command, release:prepare goes through:
$ mvn release:prepare -Dusername=myself -Dpassword=mypass
settings.xml
<servers>
<server>
<id>svnrepo</id>
<username>myself</username>
<password>mypass</password>
</server>
</servers>
pom.xml
<scm>
<connection>scm:svn:https://localhost/svn/repo/myrepo</connection>
<developerConnection>scm:svn:https://localhost/svn/repo/myrepo/myapp/trunk</developerConnection>
<url>scm:svn:https://localhost/svn/repo/myrepo</url>
</scm>
<distributionManagement>
<repository>
<id>svnrepo</id>
<url>svn:https://localhost/svn/repo/myrepo/myapp/releases</url>
</repository>
<snapshotRepository>
<id>svnrepo</id>
<url>svn:https://localhost/svn/repo/myrepo/myapp/snapshots</url>
</snapshotRepository>
</distributionManagement>
Why does it not work when I omit username and password?
I see that you are using https. Probably it has to do with your server's certificate. Is it using a self-signed certificate?
If so, setup maven to trust these: like this
Summary:
Create a file called svn-settings.xml in your user directory (e.g: C:\Users\YourUsername.scm\svn-settings.xml) with the following content:
<svn-settings>
<trustServerCert>true</trustServerCert>
</svn-settings>

mvn deploy snapshot to nexus oss failed with return code 500 internal error

I use maven to deploy artifact to sonatype nexus,I can perform release action normally,but deploy snapshots failed.
sonatype nexus 2.7.0.5
Java 1.7
maven 3.0.5
mvn release:prepare;mvn release:perform; successful without any error
mvn deploy failed with return code 500
[INFO] maven-jar-plugin:2.4:jar (default-jar) # licm
[INFO] Building jar: /foo/licm/trunk/target/licm-0.2.9-SNAPSHOT.jar
[INFO]
[INFO] maven-install-plugin:2.3.1:install (default-install) # licm
[INFO] Installing /foo/licm/trunk/target/licm-0.2.9-SNAPSHOT.jar to /foo/.m2/repository/com/xxx/utils/licm/0.2.9-SNAPSHOT/licm-0.2.9-SNAPSHOT.jar
[INFO] Installing /foo/licm/trunk/pom.xml to /foo/.m2/repository/com/xxx/utils/licm/0.2.9-SNAPSHOT/licm-0.2.9-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) # licm ---
Downloading: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml
from/to Snapshots (http://xxx.xxx.com:8080/nexus/content/repositories/snapshots): Failed to transfer file:
http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/
maven-metadata.xml. Return code is: 500 , ReasonPhrase:Internal Server Error.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.824s
[INFO] Finished at: Fri Dec 20 01:20:33 CST 2013
[INFO] Final Memory: 8M/20M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) on project licm: Failed to retrieve remote metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.xxx.utils:licm:0.2.9-SNAPSHOT/maven-metadata.xml from/to Snapshots (http://xxx.xxx.com:8080/nexus/content/repositories/snapshots): Failed to transfer file: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml. Return code is: 500 , ReasonPhrase:Internal Server Error. -> [Help 1]"
This is my first time to deploy snapshots to remote repository,so there have nothing in snapshot repository on nexus server
settings.xml
<?xml version="1.0"?>
<settings>
<servers>
<server>
<id>Releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>Snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>Nexus</id>
<name>Nexus Public Mirror</name>
<url>http://xxx.xxx.com:8080/nexus/content/groups/public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
pom.xml
<distributionManagement>
<repository>
<id>Releases</id>
<name>xxx Releases Repositories</name>
<url>http://xxx.xxx.com:8080/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>Snapshots</id>
<name>xxx Snapshots Repositories</name>
<url>http://xxx.xxx.com:8080/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
I've encountered the same return code (500) and reason (Internal server error), and finnaly found that the nexus server disk space is full. :) Checking the nexus log in the server could find this clue.
Answer myself.
When the nexus server can't find the maven-metadata.xml,it will cause tomcat throw an exception,this is the problem
I change the Tomcat version from 6.x to 7.0.x,everything is ok
Nexus requires a Servlet 3.0 compliant container. It comes bundled with a Servlet 3.0 compliant Jetty 8. If you deploy it on another container you have to make sure it is compliant. Couldn't find this in the documtation but from own experience it seems to be the case.
When you
HTTP GET
http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml
in a browser you should be able to see the stacktrace, which contains
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()
This is only available in Servlet 3.0 containers.
This was the error reported as similar in my case:
Failed to transfer file:
http://192.168.0.2:8080/repository/maven-snapshots/org/xxxx/xxx-yyy/1.0-SNAPSHOT/maven-metadata.xml.
Return code is: 500 , ReasonPhrase:Server Error.
In my case after doing the http file verification suggested by #hansi, the server response was javax.servlet.ServletException: java.lang.NumberFormatException: null.
After doing some review about what causes this, I found that is is because a problem with the artifact creation timestamp. In my case the maven-metadata.xml was corrupted and it was caused by a reboot in the server that adjusted the time automatically after the daylight saving time was in efect. I got a clue about it in this post https://issues.sonatype.org/browse/NEXUS-12496
What worked in my case was to delete the maven-metadata.xml in all the artifact references. After that the error was corrected.
In here we get failure.
Downloading: http://xxx.xxx.com:8080/nexus/content/repositories/snapshots/com/xxx/utils/licm/0.2.9-SNAPSHOT/maven-metadata.xml
then we cant get that release snapshot so we do manually in pom.xml file
updated to related dependency details then it will work.

Maven install error: Dependency could not be resolved

I am using Maven 3.1.1. When I run mvn install I get the following error:
D:\spring source>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringDependencies 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.648s
[INFO] Finished at: Mon Dec 16 15:01:47 IST 2013
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of it
s dependencies could not be resolved: Failed to read artifact descriptor for org
.apache.maven.plugins:maven-dependency-plugin:jar:2.8: Could not transfer artifa
ct org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to central (htt
p://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.mave
n.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException
My pom.xml is:
<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>spring-source-download</groupId>
<artifactId>SpringDependencies</artifactId>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>download-dependencies</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory> ${project.build.directory}/dependencies </outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Could not transfer artifact
org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to
central (http://repo.maven.apache.org/maven2): repo.maven.apache.org:
Unknown host repo.maven.apache.org
It seems like your maven cannot access remote central repository.
Check if you have an established internet connection.
Check if you can access default maven repo http://repo.maven.apache.org/maven2 in your browser.
Check if you have correct configuration in <repositories> and <proxies> in your your settings.xml
This error comes due to the proxy settings.
First of all, check whether you are able to connect to maven repository(http://repo1.maven.org/maven2) from browser.
Then update Maven proxy setting create/update a settings.xml in .m2 directory with following details:
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>{your proxy server host name}</host>
<port>{your proxy server port}</port>
<nonProxyHosts>maven</nonProxyHosts>
</proxy>
</proxies>
Solution given by Maven community: http://maven.apache.org/guides/mini/guide-proxies.html
This is caused by corrupted maven or plugins folder. To resolve this:
Delete \.m2\repository\org\apache\maven
mvn dependency:resolve -X
Where is my Settings.xml?
Windows users
It's in your C:/Users/<Username>/.m2/settings.xml
Also, this is for specific user.
Global one can be present at :
<Maven-Installation-Directory>/conf/settings.xml
But changing the User one might solve the issue if you can't find the global one.
Also, equally important, go to Preferences in Eclipse/STS:
Goto Maven -> User Settings
and verify if both global and user settings.xml files are mentioned in the properties, if not mention them by browsing.
1. Proxy Issue
Check Windows Proxy Setting.
If there is any proxy which your computer is using then you need to add proxy settings in your settings.xml file too.
Just add this chunk of code in your settings.xml
<proxies>
<proxy>
<id>proxy-id</id>
<active>true</active>
<protocol>http</protocol>
<host>ca-something.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>
2. Protocol Issue
Visit http://repo.maven.apache.org/: If it says Https required.
Then, you need to add this chunk of code to your settings.xml inside <mirrors>
<mirror>
<id>central-secure</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
Now it should be good to go.
3. None of the above works
Try disconnecting any company private VPN and try mvn clean build.
Disconnect from VPN and then run the command.
Probably a bit late to the party, but there appears to be an unknown host exception thrown out of maven even if the resource/dependency is unavailable at that address.
Which could mean that the problem may actually be that you have a transitive dependency that is pointing you to the wrong version of a jar (or one that is transitively included multiple times - one of which may be an unresolvable version). (I see it's looking for version 2.8 of the plugin but you specified version 3.1.1, so it's likely you have another dependency transitively including the wrong version).
You can exclude transitive inclusion of a dependency using the exclusions tag.
This issue was resolved for us by providing the correct proxy host in .m2/settings.xml.
Example:
<proxies>
<proxy>
<id>XXXXXXXXXX</id>
<active>true</active>
<protocol>http</protocol>
<host>na-xxxx-proxy.na.xxxxxxxxxx.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>

Failed to deploy artifacts: Could not find artifact

I want to deploy a library to my companies remote repository.
It's the first time I want to deploy the library project to the remote repository.
I get the following error message:
org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com/)
Maybe I understand something complete wrong, but the error message says, that in the remote repository doesn't exist the artifact that I try to deploy for the first time. So of course there is not such artifact. Why does maven tries to fetch the artifact when I try to upload the artifact?
My pom file:
<?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.0http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.http</groupId>
<artifactId>httpkit</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>httpkit</name>
<properties>
<platform.version> 4.1.1.4</platform.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<!-- Deploy to internal maven repository -->
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Internal Repository</name>
<url>http://jenkins.internal.com/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>16</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I call
mvn deploy
from command line
Any suggestion how to fix that problem?
EDIT: The failure log (running mvn deploy -X)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project httpkit: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project httpkit: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:141)
at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:157)
... 21 more
Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:280)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:211)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:443)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
... 23 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.repo (http://jenkins.internal.com/)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:837)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:467)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:274)
... 26 more
[ERROR]
[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
Have you tried to add the server in your settings.xml file? The default settings xml is located in your ~/.m2/ directory. Should contain something like that:
<servers>
<server>
<id>my-internal-nexus-repo</id>
<username>yourUserName</username>
<password>yourPassword</password>
</server>
</servers>
Here is a link to the http://maven.apache.org/settings.html maven doc for adding servers.
One other thing which might be a shot in the dark. I've noticed you are trying to connect to what the url suggests might be a Jenkins instance. Jenkins is a Continious Integration server and seemed strange to me that you are finding your repositories there. I would expect a Nexus url or something.
A possible cause is that you simply misspelt the repository name, or used the wrong repository name entirely
So using the OP's example:
Failed to deploy artifacts: Could not find artifact com.http:httpkit:jar:0.0.1 in internal.
repo (http://jenkins.intrnal.com)
could actually mean
Failed to deploy artifacts: Could not find internal.repo (http://jenkins.intrnal.com)
We have faced this issue. After couple of hours, we figured it is disk space issue in internal repository.
I ran into a similar problem and solved by
Adding my nexus server as a nonProxyHost in settings.xml
Setting the 3rd party's Repository Policy to Release rather than
Snapshot.
See more details in my stackoverflow answer.
Note that I was doing a "mvn deploy:deploy-file" (which uploads a 3rd party artifact to the shared repository) whereas you are doing a "mvn deploy" (which uploads YOUR artifact from your built project to the shared repository), but the root cause maybe the same.
In my case my server url in snapshotRepository section of pom.xml was pointing to http, while my internal repository was hosted in https.
Regarding the error:
Failed to deploy artifacts: Could not transfer artifact
Solution:
A very simple way to fix this is just by changing/updating the version in the pom.xml file. Suppose 01.16.03 is already used then try using 01.16.04 instead. It should work.
Okay...I encountered the same issue some days ago.
And after fiddling around with all sort of permutations and combination, I finally arrived at the conclusion.
Those who says that the reactor automatically sorts and resolves all dependencies on its own are incorrect. It seems that the link below describes it all. Kindly look at the last point under "Reactor Sorting" section:
https://maven.apache.org/guides/mini/guide-multiple-modules.html#Reactor_Sorting
It suggests that the order in which the modules are defined are taken into consideration when no other rules applies.
I hope that helps other. :)
It is because your Maven not able to find settings file. If deleting .m2 not work, try below solution
Go to your JOB configuration
than to the Build section
Add build step :- Invoke top level maven target and fill Maven version and Goal
than click on Advance button and mention settings file path as mention in image
Today i encountered the same issue.My solution was to upgrade pom version.Sure,you can also modify the nexus settings so that the same version number can be uploaded repeatedly,but the second method I haven't practiced myself, you can try.
In my case, Blob Store is almost running out of space. I have forgotten to set up clean-up policies. Once the disk space is cleared this issue is solved.
Maven knows the URL of the repository to deploy to from the repository (or snapshotRepository) sub elements of the distributionManagement element in the POM:
<distributionManagement>
<repository>
<id>{some ID}</id>
<name>{some helpful name}</name>
<url>http://example.com:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
...
</snapshotRepository>
</distributionManagement>
But Maven will also need to know the user-name and password to use. That can't be in the (public, published) POM, but is instead in a server element in your Maven settings file (~/.m2/settings.xml):
<servers>
<server>
<id>{some ID}</id>
<username>{username}</username>
<password>{password}</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
...
</servers>
Because the settings file can contain credentials for multiple servers, it needs a means of associating your POM repository with the appropriate settings server. It uses the content of the id sub element to identify which server credentials to use with which repository.
Obviously, if you use the wrong id (completely wrong or having a typo) then Maven will not know which credentials to use. However, Maven does not output a warning or error message in this case. It tries (using no credentials?) to do the upload, which of course fails with 401 Unauthorized.
Therefore, if deployment fails with a mysterious 401 Unauthorized, one thing to check is that your repository and server id values are the same.

Resources