maven本地配置及pom.xml配置解决未指定jdk版本错误
2017-10-20 08:59
579 查看
一、maven本地配置
<?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">
<!-- 本地仓库地址 -->
<localRepository>E:\MavenRepo\repository</localRepository>
<!-- 是否使用本地仓库(先从本地查找依赖,如果没有再使用远程仓库) -->
<interactiveMode>true</interactiveMode>
<!-- 是否离线(如果为true则只从本地仓库查找依赖) -->
<offline>false</offline>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>ali-maven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<!-- 中央仓库在中国的镜像 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- apache -->
<mirror>
<id>apache</id>
<name>apache mirrors</name>
<url>http://repository.apache.org/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>apache-snapshots</id>
<name>apache-snapshots-mirrors</name>
<url>http://repository.apache.org/content/groups/snapshots/</url>
<mirrorOf>snapshots</mirrorOf>
</mirror>
</mirrors>
<profiles>
<!-- 指定jdk版本,解决编译或打包时出现jdk版本未指定错误 -->
<profile>
<id>custom-compiler</id>
<properties>
<JAVA8_HOME>D:\Java\jdk1.7.0_80</JAVA8_HOME>
<JAVA7_HOME>D:\Java\jdk1.8.0_121</JAVA7_HOME>
<JAVA6_HOME>D:\Java\jdk1.6.0_43</JAVA6_HOME>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>custom-compiler</activeProfile>
</activeProfiles>
</settings>
二、maven项目的pom.xml配置
如下面配置,采用jdk7作为项目默认jdk编译版本<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerVersion>1.0</compilerVersion>
<verbose>true</verbose>
<fork>true</fork>
<executable>${JAVA7_HOME}/bin/javac</executable>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
相关文章推荐
- 如何让Tomcat在指定JDK版本下启动而不依赖环境变量中配置的版本,解决部署到Tomcat中报404版本错误问题
- 如何让Tomcat在指定JDK版本下启动而不依赖环境变量中配置的版本,解决部署到Tomcat中报404版本错误问题
- maven pom.xml配置本地jar包
- 【Maven】Project configuration is not up-to-date with pom.xml错误解决方法
- maven配置 指定jdk版本
- maven setting.xml 多仓库配置(插件依赖来自不同私服,须保证pom.xml中插件版本的唯一性)
- Maven的Setting.xml配置默认JDK,本地仓库,repositories
- 【Maven】Project configuration is not up-to-date with pom.xml错误解决方法
- pom.xml无法引入本地的jar和安装到本地安装maven 错误: 找不到或无法加载主类 org.codehaus.plexus.classworlds.launcher.Launcher
- 解决 在POM配置Maven plugin提示错误“Plugin execution not covered by lifecycle configuration”
- 导入Maven项目json-lib有红色感叹号,在pom.xml下中的json-lib下添加<classifier>jdkXX</classifier>即可解决
- eclipse搭建maven项目 pom.xml出现红叉,提示Missing artifact jdk.tools:jdk.tools:jar:1.7,解决办法如下:
- 解决maven重新导入项目时,pom.xml中<packaging>war</packaging>错误的方法
- Maven本地仓库和JDK默认版本配置
- maven pom.xml指定jdk
- 【Maven】Project configuration is not up-to-date with pom.xml错误解决方法
- maven项目找不到pom.xml配置的dependency jar中的类问题解决方法
- day76_maven02:maven拆分各层配置后,【pom.xml、Spring配置都按层拆分(dao/service/action)】,导致报错解决。
- 大数据IMF传奇行动 java maven工程(pom.xml配置) 本地模式运行词频统计
- 【Maven】Project configuration is not up-to-date with pom.xml错误解决方法