简体   繁体   中英

How to run maven project in Docker using Dockerfile when I have a custom repository

I have a project called escomled-machinelearning that uses Blackboard hazelcast instance from other project called escomled-common . I have added the escomled-common in <dependencies> of the escomled-machinelearning project. The project works, but when I try to run it in a Docker container using Dockerfile , it gives me an error:

com.escomled.machinelearning:escomled-machine-learning:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at escomled:escomled-common:jar:0.0.1

My Dockerfile :

FROM maven:3.3.9-jdk-8-alpine as build-env
COPY . /app
WORKDIR /app
RUN mvn package

FROM openjdk:8-jdk-alpine
WORKDIR /app
CMD java -jar app.jar
COPY --from=build-env /app/target/*.jar app.jar

I think the problem is that maven is trying to find escomled:escomled-common:jar:0.0.1 in maven:3.3.9-jdk-8-alpine . HELP

You need to add the settings.xml file that points to your custom respository. This is document in the dockerhub page for the maven image .

To add your custom settings.xml file to the image use

COPY settings.xml /usr/share/maven/ref/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM