在没有 Maven 的情况下将工件上传到 Nexus 3

Upload an artifact to Nexus 3 without Maven

是否可以在不使用 Maven 的情况下将工件(WAR 文件)上传到 Nexus 3 存储库?

documentation for Nexus Repository Manager 2.9中,它说:

To upload artifacts to a repository, select a hosted repository in the Repositories panel and then click on the Artifact Upload tab.

当你说“不使用 Maven”时,你的意思是“完全不使用 mvn”或者只是“不使用 Maven 来构建 WAR”?

如果是后者,那么我建议在给定的 GAV 下使用 mvn deploy:deploy-file. This can deploy arbitrary files 到任何远程存储库,包括您的 Nexus 3。

编辑:

您有两个选择,首先,如果存储库格式是原始格式,您可以使用 Direct Deploy 上传任何类型的文件,如他们的文档中所述:

Direct Deploy

You can do an HTTP PUT of a file into /repository/your-repo-id/path-to-file
Using curl you can do this with:

curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/repository/maven-releases/org/foo/1.0/foo-1.0.pom

第二个选项是在存储库格式为 maven2 的情况下,然后您可以使用 mvn deploy:deploy-file 命令上传 war 文件,例如:

mvn deploy:deploy-file -DgroupId=com.somecompany -DartifactId=project -Dversion=1.0.0 -DgeneratePom=true -Dpackaging=war -DrepositoryId=nexus -Durl=your-repo-url -Dfile=example.war