在docker中运行maven - 名称或服务未知:未知主机mvn

时间:2018-03-12 15:35:59

标签: maven docker jenkins

我在Docker中运行Maven作为Jenkins构建的一部分,遇到maven似乎无法下载任何依赖项的问题。

无论是从Jenkins运行,还是直接从命令行运行,我都会收到此错误。我尝试以root用户身份运行命令,并以jenkins用户身份运行,但得到的结果相同。

run -v "$(pwd)":/usr/share/tomcat7/.jenkins/workspace/MyProject/main -w /usr/share/tomcat7/.jenkins/workspace/MyProject/main maven mvn clean install -DskipTests

...产生以下输出:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.mycompany:myproject >--------------------------
[INFO] Building MyProject rolling
[INFO] --------------------------------[ pom ]---------------------------------
Downloading from central: http://mvn/repo/org/apache/maven/plugins/maven-jar-plugin/2.2/maven-jar-plugin-2.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.571 s
[INFO] Finished at: 2018-03-12T15:24:53Z
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.2: Could not transfer artifact org.apache.maven.plugins:maven-jar-plugin:pom:2.2 from/to central (http://mvn/repo): mvn: Name or service not known: Unknown host mvn: Name or service not known -> [Help 1]

0 个答案:

没有答案