我正在尝试将工件上传到我在Nexus中的"maven-central“存储库。我使用的命令是:
curl -v --user admin:admin123 --upload-file /path/myjar.jar http://nexus-nexus3.apps.lab.ca/repository/maven-central/com/tp/mycompany/1.0/myjar.jar我发现了一个错误:
用户代理: curl/7.54.0接受:/内容长度: 560414 Expect: 100-继续HTTP/1.1 400对Maven 2存储库的无效路径日期: Fri 2018年3月9日15:54:10 GMT服务器: Nexus/3.9.0-01 (开放源码软件)
我尝试过来自sonatype文档的多个curl命令,但都没有效果。我的问题是,这可能吗?UI只允许我选择上传到maven版本和nuget托管。我怎么才能避开这一切?
发布于 2018-03-09 17:58:14
我不确定您是否真的想通过maven-central将专有的jars上传到开放的世界。
非常常见的做法是指定和使用maven-central和公司专用存储库的组合,托管专有的jars。你应该小心这件事的影响。
在maven中心上传一件艺术品.
要将您的工件上传到中心maven中,必须先给出这里。
为什么我们有需求? 为了确保中央仓库中可用组件的最低质量,我们已经建立了一些您的部署组件必须满足的要求。这允许用户从中央存储库中提供的元数据中查找有关组件的所有相关细节。
所提出的一些要点:
完整示例下面的完整示例显示了项目和modelVersion的XML和必需元素以及示例元素和内容。
<?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.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.simpligility.training</groupId>
<artifactId>ossrh-demo</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>ossrh-demo</name>
<description>A demo for deployment to the Central Repository via OSSRH</description>
<url>http://github.com/simpligility/ossrh-demo</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>Manfred Moser</name>
<email>manfred@sonatype.com</email>
<organization>Sonatype</organization>
<organizationUrl>http://www.sonatype.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/simpligility/ossrh-demo.git</connection>
<developerConnection>scm:git:ssh://github.com:simpligility/ossrh-demo.git</developerConnection>
<url>http://github.com/simpligility/ossrh-demo/tree/master</url>
</scm>
...
</project>发布于 2018-03-15 07:38:11
我假设默认情况下,您所调用的maven-central存储库是一个代理存储库,它镜像Maven Central。上传到代理存储库是没有意义的。您应该将您的工件上传到另一个存储库,例如maven版本,这是一个所谓的托管存储库.
您不能将工件上传到在Nexus文档中编写的代理存储库。在Nexus中创建一个单独的托管存储库(在默认情况下,已经定义了一些第三方)并将它们上传到.
您需要处理您的Nexus配置更正(显然不是这样)。您有存储库组,它将不同的存储库组合成一个逻辑存储库,用于访问(消费)工件。
要正确访问nexus组,您应该具有如下设置。给定的URL是存储库组的URL,它在Nexus中配置为使用工件。
应该将Maven中的distributionManagement配置为使用两个单独的repos,而一个是发布存储库,另一个是快照存储库。
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>https://stackoverflow.com/questions/49197634
复制相似问题