Maven

From campisano.org
Jump to navigation Jump to search

Maven

Tip to change Java runtime for maven

  • see current maven version
user@host:~/eclipseJee/Code$ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"
  • test an alternative version
user@host:~/eclipseJee/Code$ JAVA_HOME=/usr/local/eclipseJee/jdk8/jdk1.8.0_112/jre mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: /usr/local/eclipseJee/jdk8/jdk1.8.0_112/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"
  • an alias can be configured to use this alternative version with a simple command
user@host:~/eclipseJee/Code$ alias mj8="JAVA_HOME=/usr/local/eclipseJee/jdk8/jdk1.8.0_112/jre mvn"
user@host:~/eclipseJee/Code$ mj8 -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: /usr/local/eclipseJee/jdk8/jdk1.8.0_112/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"