【Maven】Maven setting配置文件

原文见:https://blog.csdn.net/kikock/article/details/80466373


Maven setting配置镜像仓库

配置本地仓库

   1

  2 E:\JAVA\Maven

国内Maven镜像仓库


     
     
     
     
  1. <mirror>
  2. <id>alimaven id>
  3. <name>aliyun maven name>
  4. <url>http://maven.aliyun.com/nexus/content/groups/public/ url>
  5. <mirrorOf>central mirrorOf>
  6. mirror>
  7. <mirror>
  8. <id>alimaven id>
  9. <mirrorOf>central mirrorOf>
  10. <name>aliyun maven name>
  11. <url>http://maven.aliyun.com/nexus/content/repositories/central/ url>
  12. mirror>
  13. <mirror>
  14. <id>ibiblio id>
  15. <mirrorOf>central mirrorOf>
  16. <name>Human Readable Name for this Mirror. name>
  17. <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/ url>
  18. mirror>
  19. <mirror>
  20. <id>jboss-public-repository-group id>
  21. <mirrorOf>central mirrorOf>
  22. <name>JBoss Public Repository Group name>
  23. <url>http://repository.jboss.org/nexus/content/groups/public url>
  24. mirror>
  25. <mirror>
  26. <id>central id>
  27. <name>Maven Repository Switchboard name>
  28. <url>http://repo1.maven.org/maven2/ url>
  29. <mirrorOf>central mirrorOf>
  30. mirror>
  31. <mirror>
  32. <id>repo2 id>
  33. <mirrorOf>central mirrorOf>
  34. <name>Human Readable Name for this Mirror. name>
  35. <url>http://repo2.maven.org/maven2/ url>
  36. mirror>


maven项目编译jdk版本更改

首先要下载
maven-compiler-plugin   jar包

通过maven-compiler-plugin  jar包指定JDK版本和编码

方法1

在maven项目的pom.xml中加入一下代码

     
     
     
     
  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.maven.plugins groupId>
  5. <artifactId>maven-compiler-plugin artifactId>
  6. <version>2.1 version>
  7. <configuration>
  8. <source>1.7 source>
  9. <target>1.7 target>
  10. configuration>
  11. plugin>
  12. plugins>
  13. build>


然后重新update maven就可以解决该问题

【Maven】Maven setting配置文件_第1张图片

方法2

修改maven配置文件


     
     
     
     
  1. <profile>
  2. <id>jdk-1.8 id>
  3. <activation>
  4. <activeByDefault>true activeByDefault>
  5. <jdk>1.8 jdk>
  6. activation>
  7. <properties>
  8. <maven.compiler.source>1.8 maven.compiler.source>
  9. <maven.compiler.target>1.8 maven.compiler.target>
  10. <maven.compiler.compilerVersion>1.8 maven.compiler.compilerVersion>
  11. properties>
  12. profile>

然后刷新

先右键项目 选择maven选项add plugin

【Maven】Maven setting配置文件_第2张图片

搜索compiler  选最新的

【Maven】Maven setting配置文件_第3张图片

然后强制更新项目

完整setting配置


1. 本地仓库路径由 .m2/repository 更改到E:\java\maven

2.增加国内镜像仓库2个

3.maven 编译器版本更改为javaSE-1.8


     
     
     
     
  1. xml version="1.0" encoding="UTF-8" ?>
  2. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  3. xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation= "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  5. profiles>
  6. settings>


你可能感兴趣的:(Maven)