问题:Fatal error compiling: invalid target release: 1.7 -> [Help 1]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project bugkillers-core: Fatal error compiling: invalid target release: 1.7 -> [Help 1]
[ERROR]
解决:
1、mvn -v 显示结果如下,
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00) Maven home: /usr/share/java/apache-maven-3.2.5 Java version: 1.6.0_65, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: en_US, platform encoding: MacRoman OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
2、pom设置如下:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin>
3、但是java -version 的结果如下:
java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
4、编译没有使用到1.7,设置maven的java home 为1.7(本机设置了多版本的jdk)
修改maven的配置,java_home指向 1.7 ,/etc/mavenrc 和 ~/.mavenrc。两个文件默认不存在,需要新建,可以任选一个
比如:vi ~/.mavenrc
写入:
JAVA_HOME=`/usr/libexec/java_home -v 1.7`
5、再mvn -v ,结果如下:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00) Maven home: /usr/share/java/apache-maven-3.2.5 Java version: 1.7.0_79, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
6、解决
相关推荐
赠送jar包:commons-dbutils-1.7.jar; 赠送原API文档:commons-dbutils-1.7-javadoc.jar; 赠送源代码:commons-dbutils-1.7-sources.jar; 赠送Maven依赖信息文件:commons-dbutils-1.7.pom; 包含翻译后的API文档...
赠送jar包:commons-configuration-1.7.jar; 赠送原API文档:commons-configuration-1.7-javadoc.jar; 赠送源代码:commons-configuration-1.7-sources.jar; 赠送Maven依赖信息文件:commons-configuration-1.7....
赠送jar包:commons-dbutils-1.7.jar; 赠送原API文档:commons-dbutils-1.7-javadoc.jar; 赠送源代码:commons-dbutils-1.7-sources.jar; 赠送Maven依赖信息文件:commons-dbutils-1.7.pom; 包含翻译后的API文档...
赠送jar包:commons-configuration-1.7.jar; 赠送原API文档:commons-configuration-1.7-javadoc.jar; 赠送源代码:commons-configuration-1.7-sources.jar; 赠送Maven依赖信息文件:commons-configuration-1.7....
对应Maven信息:groupId:org.apache.velocity,artifactId:velocity,version:1.7 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持...
赠送jar包:spring-messaging-4.3.12.RELEASE.jar; 赠送原API文档:spring-messaging-4.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-messaging-4.3.12.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-...
赠送jar包:snappy-java-1.1.1.7.jar; 赠送原API文档:snappy-java-1.1.1.7-javadoc.jar; 赠送源代码:snappy-java-1.1.1.7-sources.jar; 赠送Maven依赖信息文件:snappy-java-1.1.1.7.pom; 包含翻译后的API文档...
对应Maven信息:groupId:org.apache.velocity,artifactId:velocity,version:1.7 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持...
赠送jar包:snappy-java-1.1.1.7.jar; 赠送原API文档:snappy-java-1.1.1.7-javadoc.jar; 赠送源代码:snappy-java-1.1.1.7-sources.jar; 赠送Maven依赖信息文件:snappy-java-1.1.1.7.pom; 包含翻译后的API文档...
赠送jar包:spring-beans-5.2.0.RELEASE.jar; 赠送原API文档:spring-beans-5.2.0.RELEASE-javadoc.jar; 赠送源代码:spring-beans-5.2.0.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-beans-5.2.0....
赠送jar包:spring-data-keyvalue-2.3.9.RELEASE.jar; 赠送原API文档:spring-data-keyvalue-2.3.9.RELEASE-javadoc.jar; 赠送源代码:spring-data-keyvalue-2.3.9.RELEASE-sources.jar; 赠送Maven依赖信息文件:...
赠送jar包:spring-boot-configuration-processor-2.3.12.RELEASE.jar; 赠送原API文档:spring-boot-configuration-processor-2.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-boot-configuration-processor-...
选择“File -> Import -> Maven -> Existing Maven Projects”,然后选择项目的根目录即可。 - **使用Maven生命周期**:在Eclipse中,可以通过右键点击项目并选择“Run As -> Maven build”来执行特定的Maven生命...
赠送jar包:spring-context-5.2.15.RELEASE.jar; 赠送原API文档:spring-context-5.2.15.RELEASE-javadoc.jar; 赠送源代码:spring-context-5.2.15.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-context-...
<artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <source>1.8</source> <!-- 指定源代码兼容的JDK版本 --> <target>1.8</target> <!-- 指定编译的目标JVM版本 --> ...
赠送jar包:spring-security-core-5.3.9.RELEASE.jar; 赠送原API文档:spring-security-core-5.3.9.RELEASE-javadoc.jar; 赠送源代码:spring-security-core-5.3.9.RELEASE-sources.jar; 赠送Maven依赖信息文件:...
赠送jar包:spring-session-core-2.0.5.RELEASE.jar; 赠送原API文档:spring-session-core-2.0.5.RELEASE-javadoc.jar; 赠送源代码:spring-session-core-2.0.5.RELEASE-sources.jar; 赠送Maven依赖信息文件:...
<artifactId>maven-resources-plugin</artifactId> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build> </project> 3.6.生命周期 Maven -build...
赠送jar包:spring-plugin-metadata-2.0.0.RELEASE.jar; 赠送原API文档:spring-plugin-metadata-2.0.0.RELEASE-javadoc.jar; 赠送源代码:spring-plugin-metadata-2.0.0.RELEASE-sources.jar; 赠送Maven依赖信息...
赠送jar包:spring-security-rsa-1.0.10.RELEASE.jar; 赠送原API文档:spring-security-rsa-1.0.10.RELEASE-javadoc.jar; 赠送源代码:spring-security-rsa-1.0.10.RELEASE-sources.jar; 赠送Maven依赖信息文件:...