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?

  • App running on docker consuming page cache of host machine.Is that anti-pattern ?
  • File permission error when installing Meteor in Docker
  • Jenkins: Don't want to trigger on Git Tag (No Workspace)
  • How to search for an docker image in multiple private registries
  • Docker-Compose error with Kanban and Redis
  • How to connect to docker VM (MobyLinux) from windows shell?
  • Communicating with a Solr 4.10 container in docker-compose
  • Connection between docker container
  • Installing GNOME Desktop on Centos 7 minimal : Docker image
  • Why does apache2 does not remove pid file on reboot on docker image
  • Should Docker be used in a non devops, not very agile environment? [closed]
  • How to let docker container access host network port
  • 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.