How to execute .jar from pom.xml from cloned project in Dockerfile

I have this in my Dockerfile:

FROM maven:3.3-jdk-8-alpine

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

RUN apk add --no-cache curl tar bash wget git

RUN git clone
RUN cd myproject

WORKDIR /usr/src/app/myproject


ONBUILD RUN mvn install

CMD ["java","-jar","/usr/src/app/myproject/target/ReadDocFile.jar"]

I was able to figure out how to install pom from that cloned repo – but I don’t know where is my final .jar stored. I just can’t find the .jar. Where does mvn install stores it? I don’t wan’t to use ONBUILD image because my project needs to be built from git repo. So how to solve this – how to find path where mvn install stores my final .jar for execution?

  • com.spotify.docker.client.DockerRequestException: Request error: DELETE unix://localhost:80/v1.12/containers/…: 409
  • Docker and Django
  • how to catch the exit event of process in docker
  • docker - in production - HA
  • Is this Docker / NGINX / Node setup actually load balancing as expected?
  • How to change docker bridge address space (subnet)?
  • 'docker-compose' not found error when command was executed in Jenkins job
  • node.JS application in docker container
  • Downloading images from custom registry with go-dockerclient hangs
  • curl: (7) Failed to connect to port 80: Connection refused
  • Accessing node_modules after npm install inside Docker
  • Why are all ports published by default with this Docker image
  • One Solution collect form web for “How to execute .jar from pom.xml from cloned project in Dockerfile”

    Your dependency is probably in your {user}/.m2/{the group name} if you did not set up maven yourself.

    Your Jar should be in /target/

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.