问题
I have maven home directory as below,
[root@localhost configuration-simple]# su -c "vi /etc/profile.d/maven.sh"
[root@localhost configuration-simple]# mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:28+0530)
Maven home: /home/kartyk/NetBeansProjects/motown.io/motown-develop/apache-maven-3.0.5
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_51/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.19.8-100.fc20.x86_64", arch: "amd64", family: "unix"
[root@localhost configuration-simple]#
Now I want to change the Maven home directory to some other folder, how could I do this through command prompt?
回答1:
I assume you are familiar with basics of your OS.
- go to Maven download page and get the latest version
- extract it in a directory of your choice (
/opt
or/usr/local
or ...) - set and export the environment variable MAVEN_HOME in your
.bashrc
- extend and export the environment variable PATH by $MAVEN_HOME/bin
来源:https://stackoverflow.com/questions/34671637/how-to-change-maven-home-directory