如何在 Nexus Repository Manager OSS 3中手动部署构件

安装 Nexus Repository Manager OSS 3后,我没有看到选项 Artifact Upload通过网页上传工件。

在 Nexus Repository Manager OSS 2.13中,可以选择执行该操作。

任何人都可以告诉我如何上传工件托管库在 Nexus3?

EDIT : < em > 从3.9.0版本开始,实现了这个功能。

140673 次浏览

You can upload artifacts via their native publishing capabilities (e.g. maven deploy, npm publish).

You can also upload artifacts to "raw" repositories via a simple curl request, e.g.

curl --fail -u admin:admin123 --upload-file foo.jar 'http://my-nexus-server.com:8081/repository/my-raw-repo/'

This isn't currently implemented in the UI in Nexus 3 (see https://issues.sonatype.org/browse/NEXUS-10121). You'll need to use curl or mvn deploy or some other option.

I'm using maven deploy file.

mvn deploy:deploy-file -DgroupId=my.group.id \
-DartifactId=my-artifact-id \
-Dversion=1.0.0.1 \
-Dpackaging=jar \
-Dfile=foo.jar \
-DgeneratePom=true \
-DrepositoryId=my-repo \
-Durl=http://my-nexus-server.com:8081/repository/maven-releases/

UPDATE: As stated in comments using quotes in url cause NoSuchElementException

But I have add server config in my maven (~/.m2/settings.xml).

<servers>
<server>
<id>my-repo</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>

References:

Maven Apache - Guide 3rd party jars

My Team built a command line tool for uploading artifacts to nexus 3.x repository, Maybe it's will be helpful for you - Maven Artifacts Uploader

My team use Gradle and Nexus OSS 3.5.2,

I have found a solution: upload artyfacts from localhost (I checked Nexus documentation and did not found anything about uploading artifacts from folders) => I have shared directory (use Apache httpd) and connected one to created new Nexus proxy repository. Now when I want to add my own artifacts I can upload ones into shared directory in my remote server.

Maybe someone find my solution useful: enter image description here

My question is here: Is it possible to deploy artifacts from local folder in Sonatype Nexus Repository Manager 3.x

This is implemented in Nexus since Version 3.9.0.

  • Login
  • Select Upload

enter image description here

  • Fill out form and upload Artifact

enter image description here

For Windows:

mvn deploy:deploy-file -DgroupId=joda-time -DartifactId=joda-time -Dversion=2.7 -Dpackaging=jar -Dfile=joda-time-2.7.jar
-DgeneratePom=true -DrepositoryId=[Your ID] -Durl=[YourURL]

To use mvn deploy:deploy-file, must add ~./m2/settings.xml

<settings>
<servers>
<server>
<id>nexus-repo</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
</settings>

command:

mvn deploy:deploy-file -DgroupId=com.example \
-DartifactId=my-app \
-Dversion=2.0.0 \
-Dpackaging=jar \
-Dfile=my-app.jar \
-DgeneratePom=true \
-DrepositoryId=nexus-repo \
-Durl=http://localhost:8081/repository/maven-releases/