diff options
author | md_5 <git@md-5.net> | 2015-06-10 19:53:41 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-06-10 19:53:41 +1000 |
commit | 191c281ceb8290bbbc6b92bc8fe697aed055d988 (patch) | |
tree | 2b82d860e39fbad0fbddad79ee7ea65a9f05f05d /src | |
parent | e9ee0aa0b7154a0ba40f606f165b1590911dc74f (diff) | |
download | buildtools-191c281ceb8290bbbc6b92bc8fe697aed055d988.tar buildtools-191c281ceb8290bbbc6b92bc8fe697aed055d988.tar.gz buildtools-191c281ceb8290bbbc6b92bc8fe697aed055d988.tar.lz buildtools-191c281ceb8290bbbc6b92bc8fe697aed055d988.tar.xz buildtools-191c281ceb8290bbbc6b92bc8fe697aed055d988.zip |
BUILDTOOLS-118: Check M2_HOME for Maven install and attempt to use it.
I have a feeling this could break people already using BuildTools with a bad M2_HOME directory, but that's really their issue.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/spigotmc/builder/Builder.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java index 0968a9c..810cf3c 100644 --- a/src/main/java/org/spigotmc/builder/Builder.java +++ b/src/main/java/org/spigotmc/builder/Builder.java @@ -171,16 +171,21 @@ public class Builder clone( "https://hub.spigotmc.org/stash/scm/spigot/builddata.git", buildData ); } - File maven = new File( "apache-maven-3.2.5" ); + File maven = new File( System.getenv( "M2_HOME" ) ); if ( !maven.exists() ) { - System.out.println( "Maven does not exist, downloading. Please wait." ); + maven = new File( "apache-maven-3.2.5" ); - File mvnTemp = new File( "mvn.zip" ); - mvnTemp.deleteOnExit(); + if ( !maven.exists() ) + { + System.out.println( "Maven does not exist, downloading. Please wait." ); + + File mvnTemp = new File( "mvn.zip" ); + mvnTemp.deleteOnExit(); - download( "http://static.spigotmc.org/maven/apache-maven-3.2.5-bin.zip", mvnTemp ); - unzip( mvnTemp, new File( "." ) ); + download( "http://static.spigotmc.org/maven/apache-maven-3.2.5-bin.zip", mvnTemp ); + unzip( mvnTemp, new File( "." ) ); + } } String mvn = maven.getAbsolutePath() + "/bin/mvn"; |