Maven配置文件(自用)

最近自己组装新电脑,又正好跳槽,连续配置了两次开发环境,配置过程及其费时,故此记录一下maven,以后用到的时候就不用踩一个坑,解决一次问题了。

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

<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
  

  
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>

  <!-- TODO Since when can proxies be selected as depicted? -->
  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>


<!-- 加在<mirrors>中添加-->
	<mirrors>
      <mirror>
		<id>mvnrepository</id>
		<mirrorOf>mvnrepository</mirrorOf>
		<url>http://mvnrepository.com/</url>
      </mirror>
	   
	   <!--    阿里仓库-->
	  <mirror>
		<id>alimaven</id>
		<name>aliyun maven</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
		<mirrorOf>central</mirrorOf>
	  </mirror>
	  
	  <!--    maven仓库官方-->
	  <mirror>
		<id>nexus</id>
		<name>internal nexus repository</name>
		<!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
		<url>http://repo.maven.apache.org/maven2</url>
		<mirrorOf>central</mirrorOf>
	  </mirror>
	
	  <mirror>
		<id>96nexus</id>
		<mirrorOf>*</mirrorOf>
		<name>96nexus</name>
		<url>http://172.18.64.96:8080/nexus/content/groups/public/</url>
	  </mirror>

	  <mirror>
		<id>nexus-aliyun</id>
		<mirrorOf>central</mirrorOf>
		<name>nexus-aliyun</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public</url>
	  </mirror>
    </mirrors>


  <profiles>
	<!-- 添加maven编译和运行项目的JDK版本以及项目编码 可解决运行报错:无效目标发行版 17 -->
	<profile>
	  <id>jdk-17</id>
	    <activation>
		  <activeByDefault>true</activeByDefault>
		  <jdk>17</jdk>
		</activation>
		<properties>
		  <maven.compiler.source>17</maven.compiler.source>
		  <maven.compiler.target>17</maven.compiler.target>
		  <maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
		</properties>
	</profile>
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

其他的有想到的,会继续补充。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值