Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6046

install maven in docker

$
0
0

I am trying to install and build one file using maven in Dockerfile, but getting an error mvn not found...I referred to some articles but I did not find anything

can anyone please help me to why I am getting this and how to solve this?

my code

FROM ubuntu:latestMAINTAINER ganeshthirumaniRUN apt-get update && apt-get install -y wgetARG USER_HOME_DIR="/root"#create a dir foe maven in optRUN mkdir /opt/mavenRUN mkdir /usr/share/maven#RUN mkdir /usr/share/maven#dwnl maven using link in tmpRUN wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz -O /tmp/maven.tar.gz#extract the fileRUN cd /tmp && tar xvf maven.tar.gz#copy the file into opt/mavenRUN cp -R /tmp/apache-maven-3.8.4/* /usr/share/maven/#RUN cp /opt/files/* /usr/share/maven# Install OpenJDK-8RUN apt-get update && \    apt-get install -y openjdk-8-jdk && \    apt-get clean;# Fix certificate issuesRUN apt-get update && \    apt-get install ca-certificates-java && \    apt-get clean && \    update-ca-certificates -f;# Setup JAVA_HOME -- useful for docker commandlineENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/RUN export JAVA_HOME#dwnl zip and move to /opt/filesRUN mkdir /opt/filesRUN  wget <this is my zip file> -O /tmp/zip_file.zipRUN cp /tmp/zip_file.zip /opt/files/ENV MAVEN_HOME /usr/share/mavenENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"RUN mvn clean install -Pdevelopment#RUN mvn clean install -Pdeployment CMD ["mvn", "--version"]

and while building...

Sending build context to Docker daemon  97.28kBStep 1/20 : FROM ubuntu:latest ---> d13c942271d6Step 2/20 : MAINTAINER ganeshthirumani ---> Using cache ---> 83dbc04930a4Step 3/20 : RUN apt-get update && apt-get install -y wget ---> Using cache ---> 5a26c629963fStep 4/20 : ARG USER_HOME_DIR="/root" ---> Using cache ---> fea8fd2bb7f6Step 5/20 : RUN mkdir /opt/maven ---> Using cache ---> 16a42d6b96c3Step 6/20 : RUN mkdir /usr/share/maven ---> Using cache ---> 012f68749248Step 7/20 : RUN wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz -O /tmp/maven.tar.gz ---> Using cache ---> dc498bb88bafStep 8/20 : RUN cd /tmp && tar xvf maven.tar.gz ---> Using cache ---> be08499a07dbStep 9/20 : RUN cp -R /tmp/apache-maven-3.8.4/* /usr/share/maven/ ---> Using cache ---> 7a705ce7213dStep 10/20 : RUN apt-get update &&     apt-get install -y openjdk-8-jdk &&     apt-get clean; ---> Using cache ---> 452e0b263645Step 11/20 : RUN apt-get update &&     apt-get install ca-certificates-java &&     apt-get clean &&     update-ca-certificates -f; ---> Using cache ---> d65d98457da5Step 12/20 : ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ ---> Using cache ---> b8cacc77d6b0Step 13/20 : RUN export JAVA_HOME ---> Using cache ---> 1a5918571b65Step 14/20 : RUN mkdir /opt/files ---> Using cache ---> 66d092f96235Step 15/20 : RUN  wget https://drive.google.com/file/d/1IutshyYqlcTw_MkfC1NJzU9AH8B-W2Fa/view?ts=61f24be4 -O /tmp/zip_file.zip ---> Using cache ---> 7180fa09993bStep 16/20 : RUN cp /tmp/zip_file.zip /opt/files/ ---> Using cache ---> bc861eb85449Step 17/20 : ENV MAVEN_HOME /usr/share/maven ---> Using cache ---> be97d22b8558Step 18/20 : ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" ---> Using cache ---> 7874ed478f2fStep 19/20 : RUN mvn clean install -Pdevelopment ---> Running in 5b58132ba431/bin/sh: 1: mvn: not foundThe command '/bin/sh -c mvn clean install -Pdevelopment' returned a non-zero code: 127

and I have seen that the basic directories are:for maven home MAVEN_HOME /usr/share/mavenfor config---> MAVEN_CONFIG "$USER_HOME_DIR/.m2 and where user_home_dir is a root

thanks in advance


Viewing all articles
Browse latest Browse all 6046

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>