まずはお時間をいただきありがとうございます。 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
しかしImはプロキシに問題がある:私は私が持っている場合、私はのsettings.xmlを追加する必要がありますが、私は知らないと仮定し
$ 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
を私のプロジェクトや別のディレクトリのルートに追加する。
挨拶!
私はあなたの推薦を試みたが、私は結果を見なかった。私の質問を変更する方法で、私はプロキシで自分の問題を追加しました。あなたの答えとあなたの時間をありがとう:) –
いいえ私はどのMaven呼び出しが問題を引き起こすかを見ます。それは 'RUN mvn dependency:resolve'です。 'RUN mvn -s settings.xml dependency:resolve'に変更するとOKになります。あるいは、複数の場合は、 'settings.xml'ファイルを'〜/ .m2/'に入れてください。 –