1. 程式人生 > >centos下安裝配置maven

centos下安裝配置maven

  • 下載maven安裝包
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

 

  • 解壓安裝包
tar -xvf apache-maven-3.3.9-bin.tar.gz
  • 刪除多餘安裝包 重新命名
rm -rf apache-maven-3.3.9-bin.tar.gz
mv apache-maven-3.3.9/ maven-3.3
  • 檢視maven版本
mvn -v

 

修改setting.xml檔案

在當前目錄下的 maven-3.3/conf/settings.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
  <pluginGroups>

  </pluginGroups>
        <!-- 配置jar包下載路徑 linux需要更改為/目錄開頭的linux目錄 -->
	<localRepository>E:/java/repo</localRepository>



  <proxies>
  													
  </proxies>


  <servers>
   				
  </servers>

  <!-- 從阿里雲映象下載jar包 -->
  <mirrors>
	<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
    </mirror>
  </mirrors>

 <!-- 指定jdk1.8 -->
 <profiles>
	<profile>	
		<id>jdk1.8</id>
		<activation>
		<activeByDefault>true</activeByDefault>
		<jdk>1.8</jdk>
		</activation>

		<properties>
			<maven.compiler.source>1.8</maven.compiler.source>
			<maven.compiler.target>1.8</maven.compiler.target>
			<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
		</properties>
	</profile>
</profiles>

</settings>

 

來自  http://blog.youxiu326.com/view/5