Maven配置倉庫路徑和下載路徑

1、配置倉庫路徑apache

打開服務器

E:\maven\apache-maven-3.5.3\conf\settings.xmlmaven

能夠看到,在52行制定了倉庫的位置是${user.home}/.m2/repository。 this

這是默認地址,若是想修改成本身想要的地址阿里雲

<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">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
   
  -->
  <localRepository>e:/maven/repository</localRepository>

   <localRepository>e:/maven/repository</localRepository>url

這是我想設置的地址能夠換成你的;code

2、配置下載路徑xml

maven 會默認從maven官方提供的服務器下載jar包。 
而官方服務器在國外,由於你們都懂得緣由,網速很慢,並且容易卡斷。 爲了便於快速下載相關jar包,能夠使用國內maven 阿里雲的下載地址ci

打開element

E:\maven\apache-maven-3.5.3\conf\settings.xml

添加在<mirrors>中添加<mirror>

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
        <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
      
  </mirrors>

3、設置jdk版本

<profiles>
		<profile>
			<id>jdk8</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>

保存就行了

相關文章
相關標籤/搜索