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?

  • HDFS data node connection error in a docker container
  • Microsoft Word crashes when invoking its COM inside Docker Container
  • Adjust OOM killer for subprocess in Docker container
  • Dockerfile: mkdir and COPY commands run fine but I can't see the directory and file
  • kairosdb service not starting in container
  • Docker Container's network interface in promiscuous mode
  • Docker Reverse Proxy To Subdomains
  • How to launch app with webpack for production in Docker container?
  • Cannot launch interactive session in Windows IIS Docker container
  • Docker image of 32 bit Ubuntu
  • Can I build a Docker image to “cache” a yocto/bitbake build?
  • docker not unzipping my files
  • 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.