Curl Sonatype Nexus使用REST API添加代理存储库
我正在尝试将代理存储库添加到本地Sonatype Nexus™ OSS 2.8.1-01使用RESTAPI和curl,但不起作用 curl命令:Curl Sonatype Nexus使用REST API添加代理存储库,curl,proxy,repository,nexus,Curl,Proxy,Repository,Nexus,我正在尝试将代理存储库添加到本地Sonatype Nexus™ OSS 2.8.1-01使用RESTAPI和curl,但不起作用 curl命令: curl -i -H "Accept: application/xml" -H "Content-Type: application/xml" -f -X POST -v -d "@/tmp/input.xml" -u "admin:admin123" "http://localhost:8081/nexus/service/local/repo
curl -i -H "Accept: application/xml" -H "Content-Type: application/xml" -f -X POST -v -d "@/tmp/input.xml" -u
"admin:admin123" "http://localhost:8081/nexus/service/local/repositories"
在此之前,它可以正常工作,我将添加在input.xml中定义的托管存储库,但不使用代理存储库
使用代理存储库,我将得到以下响应:
upload completely sent off: 445 out of 445 bytes
The requested URL returned error: 400 Bad Request
Closing connection 0
Nexus日志文件:
2014-08-12 09:57:44,189+0200 TRACE [qtp531741605-42] admin com.thoughtworks.xstream.whitelist.TypeWhitelist - All types allowed: remoteUri
2014-08-12 09:57:44,201+0200 WARN [qtp531741605-42] admin org.sonatype.nexus.rest.NexusRestletResource - Invalid XML, unable to parse using XStream class org.sonatype.nexus.rest.repositories.RepositoryListPlexusResource
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field org.sonatype.nexus.rest.model.RepositoryProxyResource.remoteUri
---- Debugging information ----
field : remoteUri
class : org.sonatype.nexus.rest.model.RepositoryBaseResource
required-type : org.sonatype.nexus.rest.model.RepositoryBaseResource
converter-type : org.sonatype.nexus.rest.repositories.RepositoryBaseResourceConverter
path : /repository/data/remoteUri
line number : 1
class[1] : org.sonatype.nexus.rest.model.RepositoryResourceResponse
converter-type[1] : org.sonatype.nexus.rest.repositories.RepositoryResourceResponseConverter
version : 1.4.6-SONATYPE-03
他将remotUri识别为未知字段,但这是配置新代理存储库所必需的字段
input.xml:
<?xml version="1.0" encoding="UTF-8"?>
<repository>
<data>
<id>maven.jenkins-ci.org</id>
<name>Jenkins CI</name>
<repoType>proxy</repoType>
<repoPolicy>RELEASE</repoPolicy>
<provider>maven2</provider>
<providerRole>org.sonatype.nexus.proxy.repository.Repository</providerRole>
<format>maven2</format>
<exposed>true</exposed>
<remoteUri>http://repo.jenkins-ci.org/public/</remoteUri>
</data>
</repository>
在nexus.properties中
我做错了什么?
希望有人能帮助我
关于Alex,我建议使用JSON而不是XML作为负载类型。如果您这样做,您可以在创建存储库时观察从UI到服务器的HTTP通信量,UI会进行您需要的RESTAPI调用 有关更多信息,请参见此处:
com.thoughtworks.xstream.whitelist.TypeWhitelist.allowAll=true