Skip to content

Instantly share code, notes, and snippets.

@speedlog
Last active April 14, 2022 21:31
Show Gist options
  • Save speedlog/af2b6e4c79ca1cba2b3c77d0e75ffd86 to your computer and use it in GitHub Desktop.
Save speedlog/af2b6e4c79ca1cba2b3c77d0e75ffd86 to your computer and use it in GitHub Desktop.
Script to install maven wrapper without having installed maven in system
wget https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper-distribution/3.1.0/maven-wrapper-distribution-3.1.0-bin.zip
unzip maven-wrapper-distribution-3.1.0-bin.zip
rm maven-wrapper-distribution-3.1.0-bin.zip
# get current version from maven repository
MAVEN_CURRENT_RELEASE=$(curl -s https://repo1.maven.org/maven2/org/apache/maven/apache-maven/maven-metadata.xml | grep -oPm1 "(?<=<release>)[^<]+")
# or uncomment below line to explicit version
#MAVEN_CURRENT_RELEASE=3.8.5
echo "distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/$MAVEN_CURRENT_RELEASE/apache-maven-$MAVEN_CURRENT_RELEASE-bin.zip" >> .mvn/wrapper/maven-wrapper.properties
echo "wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" >> .mvn/wrapper/maven-wrapper.properties
@speedlog
Copy link
Author

speedlog commented Apr 14, 2022

Usage:
curl https://gist.githubusercontent.com/speedlog/af2b6e4c79ca1cba2b3c77d0e75ffd86/raw/0356df74962dd57d0b23887636c6f87cde996234/install_maven_wrapper_without_maven.sh | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment