首先感谢您的时间。我试着去运行里面dockerfile Maven的命令:Dockerfile中的Maven生命周期
# Base container contains maven, jdk on ubuntu
FROM maven:3-jdk-8
# copy my build config pom file to container
ADD pom.xml /app/
# copy the source file directory to the container
ADD src/ /app/src/
# move the app directory inside container to perform mvn buill
WORKDIR /app/
RUN ["mvn", "dependency:resolve"]
RUN ["mvn", "verify"]
# resolve dependency offline as suggested by Nicolas
#RUN mvn dependency:go-offline
# build by using maven
RUN mvn package
但是我有与代理问题:
$ docker build -t mavenimagen .
Sending build context to Docker daemon 124.9 kB
Step 1 : FROM maven:3-jdk-8
---> b2ef69e414f5
Step 2 : ADD pom.xml /app/
---> Using cache
---> 57e5b52fe34b
Step 3 : ADD src/ /app/src/
---> Using cache
---> ace1a117cb4f
Step 4 : WORKDIR /app/
---> Using cache
---> da544b2298a1
Step 5 : RUN mvn dependency:resolve
---> Running in 26258aec0093
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-jar-plugin:2.4: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-shade-plugin/2.1/maven-shade-plugin-2.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-shade-plugin:2.1: Plugin org.apache.maven.plugins:maven-shade-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-shade-plugin:jar:2.1
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
我想,我必须补充的settings.xml,但我不知道如果我有添加到我的项目或其他目录的根目录中。
Greettings!
我想你的建议,但我没有看到结果。顺便说一句,我修改了我的问题,我用代理添加了我的问题。感谢您的回答和您的时间:) –
不,我看到哪个Maven电话导致问题。它是'运行mvn依赖:解析'。如果您将其更改为'运行mvn -s settings.xml dependency:resolve',它将会正常。或者,如果它现在不止一个,就按我的建议,把'settings.xml'文件放到'〜/ .m2 /'中。 –