Ability to upload components from the UI to a repository

1,576 views
Skip to first unread message

Nicolas Rosado

unread,
Apr 12, 2016, 8:58:58 AM4/12/16
to Nexus Users
Hi,

I saw in the milestone 7 this comment :


  • Dama Reffett

    I've installed nexus 3.0 to review for our team to use.  I don't see the ability to upload components from the UI to a repository.  was this removed? 

  • 0
    Avatar
    Manfred Moser

    Yes, this feature has been removed in one of the previous milestone releases. It will be added back in a future release.


In nexus 2.0, I think this feature is very useful and I didn't find this feature in the latest release of nexus 3.0 (cf https://books.sonatype.com/nexus-book/reference/using-sect-uploading.html).
Could you tell me in wich release this feature is planned ?

This feature is very useful in nexus 2 to upload component for the 3rd party. 
Could you tell me if nexus 3.0 be able to manage 3rd party in the latest release ?

In the nexus 3.0 I didn't find a default repository for 3rd party. Off course, I can create one (hosted repository) but could you confirm that I need to upload my 3rd party jars like this :

Little description of 3rd party :
3rd Party
This hosted repository should be used for third-party dependencies not available in the public Maven repositories. Examples of these dependencies could be commercial, proprietary libraries such as an Oracle JDBC driver that may be referenced by your organization.


Thanks in advance for your time and your response,

Brian Fox

unread,
Apr 12, 2016, 9:05:32 AM4/12/16
to Nicolas Rosado, Nexus Users
Hi Nicolas,

This feature has not yet been implemented in 3.x. It is a popular request so if possible we will get this into 3.1. No guarantees yet as the slate for 3.1 is quite full at the moment, but this is at the top of the list after Migration, Upgrade and Content Selector permissions (the replacement for repo targets).

--Brian

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/b359abc9-0cc4-4962-9286-ac4094c0686c%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Manfred Moser

unread,
Apr 12, 2016, 11:28:58 AM4/12/16
to Brian Fox, Nicolas Rosado, Nexus Users
Adding to Brians input..

if you want a dedicated repository for 3rd party components you have to create that repo. And from my experience that is a good idea just to keep them separate. Manually uploaded components often have problems like missing pom file (and therefore incomplete dependency tree) and so on. If you keep them in a separate repo and after the higher quality repositories in the group it will be only used when absolutely required.

And in terms of uploading you can use mvn on the command line  (deploy:file) goal, simple curl commands with HTTP put (but no pom will be generated automatically so you have to manually create it) or you can use transfer tools like my Maven Repository Provisioner (https://github.com/simpligility/maven-repository-tools/tree/master/maven-repository-provisioner) . It will be dependent on your use case what works best.. 

You can see an example command for a curl based upload into a raw repository at 


The same command with proper structure will work for Maven repositories. We will add more documentation for this sort of automation into the integration API chapter soon.

Ping us if you have more questions.

Manfred


Andrey Kovalev

unread,
May 16, 2016, 6:58:40 AM5/16/16
to Nexus Users
Hi Manfred.
I tried to upload an artifact using information by this url and it worked.
http://books.sonatype.com/nexus-book/3.0/reference/raw.html#_uploading_files_to_hosted_raw_repositories

But I cannot upload an artifact with maven-deploy-plugin. Debug switch didn't give much information. In response I always receive "Broken pipe".
  • Is Nexus 3 supported by maven-deploy-plugin?
  • What url should I use in <distributionManagement> section?
Thanks in advance.

Andrey Kovalev

unread,
May 16, 2016, 9:26:45 AM5/16/16
to Nexus Users
I figured out how to deploy artifacts. If someone needs it I will leave this information here.
Initially I was using this link to figure out how to deploy artifacts. But this document is for Nexus 2. So a few things were changed.
To upload an artifact with curl you need:
curl -X PUT -v -F file=@example-core.jar -u test:test http://localhost:8081/repository/maven-releases/com/example/example-core/1.0.0/example-core-1.0.0.jar
Note that url is a full maven2 layout url as it is described here
Curl command will just upload an artifact without generating any pom, sha1 and md5.
To upload with maven:
mvn deploy:deploy-file -DgroupId=com.example -DartifactId=example-core -Dversion=1.0.0 -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl=http://localhost:8081/repository/maven-releases -Dfile=example-core-1.0.0.jar -U
It will generate pom, sha1 and md5 in a repository.
test user should have the following privileges:
  • nx-repository-admin-*-*-*
  • nx-search-read
  • nx-repository-view-*-*-*

Andrey Kovalev

unread,
May 16, 2016, 9:26:55 AM5/16/16
to Nexus Users
I figured out how to deploy artifacts. If someone needs it I will leave this information here.
Initially I was using this link to figure out how to deploy artifacts. But this document is for Nexus 2. So a few things were changed.
To upload an artifact with curl you need:
curl -X PUT -v -F file=@example-core.jar -u test:test http://localhost:8081/repository/maven-releases/com/example/example-core/1.0.0/example-core-1.0.0.jar
Note that url is a full maven2 layout url as it is described here
Curl command will just upload an artifact without generating any pom, sha1 and md5.
To upload with maven:
mvn deploy:deploy-file -DgroupId=com.example -DartifactId=example-core -Dversion=1.0.0 -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl=http://localhost:8081/repository/maven-releases -Dfile=example-core-1.0.0.jar -U
It will generate pom, sha1 and md5 in a repository.
test user should have the following privileges:
  • nx-repository-admin-*-*-*
  • nx-search-read
  • nx-repository-view-*-*-*

On Tuesday, 12 April 2016 13:58:58 UTC+1, Nicolas Rosado wrote:

Peter Lynch

unread,
May 16, 2016, 9:37:45 AM5/16/16
to Andrey Kovalev, Nexus Users
Hi Andrey,

On Mon, May 16, 2016 at 10:26 AM, Andrey Kovalev <and...@gmail.com> wrote:
I figured out how to deploy artifacts. If someone needs it I will leave this information here.
Initially I was using this link to figure out how to deploy artifacts. But this document is for Nexus 2. So a few things were changed.

Nothing should in theory change other than the URL to use on the client side. Nexus 3 is mounted at the webapp root and so the repository paths are different.

However you did uncover a bug that I have filed. 


Nexus should not be causing a Broken Pipe exception when returning 401 unauthorized.

We still acknowledge there are a few bugs to work out in the Maven implementation in Nexus 3.

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.

Andrey Kovalev

unread,
May 18, 2016, 5:35:17 AM5/18/16
to Nexus Users, and...@gmail.com
You are correct Peter. Everything works as it worked in Nexus 2. I put wrong credentials at the beginning and "Broken pipe" caused confusion so I followed wrong route in order to understand the problem.

Kevin

unread,
Sep 13, 2016, 11:13:39 AM9/13/16
to Nexus Users, and...@gmail.com
Hi everyone,

we faceing also an "broken pipe" issue when we try to upload an artifact in a repository.

It works when we try it from a random system which has maven installed but failed with using our Jenkins server. (same user with same credentials).
The command we use looks like that: mvn deploy:deploy-file -DgroupId=de.* -DartifactId=*-ear -Dversion=2.2.0-SNAPSHOT -Dpackaging=ear -Dfile=* -DrepositoryID=* -Durl=* -X

Maybe one of you have an idea?

The log looks like this:
...
Uploading: http://[SERVER]:8081/repository/[REPO]/Path/to/artefact.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.863 s
[INFO] Finished at: 2016-09-13T16:40:39+02:00
[INFO] Final Memory: 11M/109M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact de....: Broken pipe -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact de....: Broken pipe
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        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:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact: de....: Broken pipe
        at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:314)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifact: de....:Broken pipe
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:143)
        at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
        at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:310)
        ... 22 more
Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact: de....: Broken pipe
        at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:317)
        at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:245)
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:413)
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:139)
        ... 24 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact: de....: Broken pipe
        at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector.put(BasicRepositoryConnector.java:274)
        at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:311)
        ... 27 more
Caused by: org.apache.maven.wagon.TransferFailedException: Broken pipe
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:646)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:541)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:523)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:517)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:497)
        at org.eclipse.aether.transport.wagon.WagonTransporter$PutTaskRunner.run(WagonTransporter.java:644)
        at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427)
        at org.eclipse.aether.transport.wagon.WagonTransporter.put(WagonTransporter.java:410)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector$PutTaskRunner.runTask(BasicRepositoryConnector.java:510)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
        ... 29 more
Caused by: java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
        at org.apache.maven.wagon.providers.http.httpclient.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:123)
        at org.apache.maven.wagon.providers.http.httpclient.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:135)
        at org.apache.maven.wagon.providers.http.httpclient.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:164)
        at org.apache.maven.wagon.providers.http.httpclient.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:115)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon$RequestEntityImplementation.writeTo(AbstractHttpClientWagon.java:205)
        at org.apache.maven.wagon.providers.http.httpclient.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:155)
        at org.apache.maven.wagon.providers.http.httpclient.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:149)
        at org.apache.maven.wagon.providers.http.httpclient.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:236)
        at org.apache.maven.wagon.providers.http.httpclient.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:254)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
        at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:832)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.put(AbstractHttpClientWagon.java:592)
        ... 38 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

Peter Lynch

unread,
Sep 13, 2016, 11:51:49 AM9/13/16
to Kevin, Nexus Users, Andrey Kovalev
On Tue, Sep 13, 2016 at 12:13 PM, Kevin <kevin....@gmail.com> wrote:
Hi everyone,

we faceing also an "broken pipe" issue when we try to upload an artifact in a repository.

It works when we try it from a random system which has maven installed but failed with using our Jenkins server. (same user with same credentials).
The command we use looks like that: mvn deploy:deploy-file -DgroupId=de.* -DartifactId=*-ear -Dversion=2.2.0-SNAPSHOT -Dpackaging=ear -Dfile=* -DrepositoryID=* -Durl=* -X


Are you literally using asterisks as values?

Otherwise, the stack trace looks exactly like the already reported issue https://issues.sonatype.org/browse/NEXUS-10234 .


 
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

To post to this group, send email to nexus...@glists.sonatype.com.

Peter Lynch

unread,
Sep 13, 2016, 2:42:10 PM9/13/16
to Kevin Begrow, Andrey Kovalev, Nexus Users
-DrepositoryID=* - To be clear the value of this must match a <server> section containing valid creds in settings.xml - this repository id is not the id/ name of the Nexus repository inside nexus.

Examine the build logs and closely examine what exact settings.xml are being loaded.


On Tue, Sep 13, 2016 at 1:10 PM, Kevin Begrow <kevin....@gmail.com> wrote:

Hello Peter,

Sorry I forgot to mention, I just had to hide company informations, so no, I don't use asterisks.
Yes it seems to be the same issue, even I don't understand why it's an 401error only with the Jenkins server. Probably the best is to check the settings.xml again.

Kevin Begrow

unread,
Sep 14, 2016, 3:52:17 AM9/14/16
to Peter Lynch, Andrey Kovalev, Nexus Users
Hello Peter,

thank you for your e-mail.

I think I've found the problem. The wrong settings.xml are being loaded.

Reply all
Reply to author
Forward
0 new messages