从命令行我可以执行mvn clean install deploy
而无需使用maven-3.2.2进行任何额外配置。因此毫无疑问maven设置的配置。尽管已启用http://maven.medicom.com.sa/maven2/releases
身份验证,但我的私有存储库basic http
可通过maven访问。正如下面是setting.xml
文件的快照。当我尝试使用Jenkins Maven插件时,由于http://maven.medicom.com.sa/maven2/releases
身份验证,它无法访问basic http
存储库。
<settings 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/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>medicom</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Basic bXE2ZX46bXVkaXMhcB==</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>medicom.plugins</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Basic bXE2ZX46bXVkaXMhcB==</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
<profiles>
<profile>
<id>medicom.releases</id>
<activation>
<property>
<name>medicom.releases</name>
<value>!false</value>
</property>
</activation>
<repositories>
<repository>
<id>medicom</id>
<url>http://maven.medicom.com.sa/maven2/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>medicom.plugins</id>
<url>http://maven.medicom.com.sa/maven2/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
答案 0 :(得分:0)
Jenkins maven插件无法通过服务器配置basic http authentication
。因此,您必须跳过Jenkins CI的此类配置。
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Basic bXE2ZX46bXVkaXMhcB==</value>
</property>
</httpHeaders>
</configuration>
相反,您应该使用用户名和密码:
<username>maven</username>
<password>password</password>
如下所示,必须删除注释行:
<settings 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/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>medicom</id>
<!-- <configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Basic bXE2ZX46bXVkaXMhcB==</value>
</property>
</httpHeaders>
</configuration> -->
<username>maven</username>
<password>password</password>
</server>
<server>
<id>medicom.plugins</id>
<!-- <configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Basic bXE2ZX46bXVkaXMhcB==</value>
</property>
</httpHeaders>
</configuration> -->
<username>maven</username>
<password>password</password>
</server>
</servers>
<profiles>
<profile>
<id>medicom.releases</id>
<activation>
<property>
<name>medicom.releases</name>
<value>!false</value>
</property>
</activation>
<repositories>
<repository>
<id>medicom</id>
<url>http://maven.medicom.com.sa/maven2/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>medicom.plugins</id>
<url>http://maven.medicom.com.sa/maven2/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>