`

【Maven】Fatal error compiling: invalid target release: 1.7 -> [Help 1]

阅读更多

问题: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、解决

 

 

本文来源于:http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece7631046893b4c4380146d96864968d4e414c42246170735b2e6617943588d9820321cfc091ab1a168252a5577f1c893d60bc0bd972a2b8a20357508c31c528516f89a187e8361c74de9de4db4fca36c84aea3849f140e8a44050bd1add4185b4a9133a5033093b1983b025f61b9fa3115e859003e9e5345&p=882a9644d78516f80be296214b0a95&newp=8b2a9713949f1fb40cbd9b7d0c17cf231610db2151d6d0106b82c825d7331b001c3bbfb423231401d7c1766c00ab495be8f63d703d0923a3dda5c91d9fb4c57479de65682e07d2&user=baidu&fm=sc&query=eclipse+Fatal+error+compiling%3A++1%2E7&qid=d7c4336e00028582&p1=2

【Maven】Fatal error compiling: invalid target release: 1.7 -> [Help 1]

分享到:
评论

相关推荐

    commons-dbutils-1.7-API文档-中文版.zip

    赠送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文档...

    commons-configuration-1.7-API文档-中文版.zip

    赠送jar包:commons-configuration-1.7.jar; 赠送原API文档:commons-configuration-1.7-javadoc.jar; 赠送源代码:commons-configuration-1.7-sources.jar; 赠送Maven依赖信息文件:commons-configuration-1.7....

    commons-dbutils-1.7-API文档-中英对照版.zip

    赠送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文档...

    commons-configuration-1.7-API文档-中英对照版.zip

    赠送jar包:commons-configuration-1.7.jar; 赠送原API文档:commons-configuration-1.7-javadoc.jar; 赠送源代码:commons-configuration-1.7-sources.jar; 赠送Maven依赖信息文件:commons-configuration-1.7....

    velocity-1.7-API文档-中文版.zip

    对应Maven信息:groupId:org.apache.velocity,artifactId:velocity,version:1.7 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持...

    spring-messaging-4.3.12.RELEASE-API文档-中英对照版.zip

    赠送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-...

    snappy-java-1.1.1.7-API文档-中文版.zip

    赠送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文档...

    velocity-1.7-API文档-中英对照版.zip

    对应Maven信息:groupId:org.apache.velocity,artifactId:velocity,version:1.7 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持...

    snappy-java-1.1.1.7-API文档-中英对照版.zip

    赠送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文档...

    spring-beans-5.2.0.RELEASE-API文档-中英对照版.zip

    赠送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....

    spring-data-keyvalue-2.3.9.RELEASE-API文档-中文版.zip

    赠送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依赖信息文件:...

    spring-boot-configuration-processor-2.3.12.RELEASE-API文档-中文版.zip

    赠送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-...

    可用的maven插件在线安装地址,eclipse->help菜单

    选择“File -&gt; Import -&gt; Maven -&gt; Existing Maven Projects”,然后选择项目的根目录即可。 - **使用Maven生命周期**:在Eclipse中,可以通过右键点击项目并选择“Run As -&gt; Maven build”来执行特定的Maven生命...

    spring-context-5.2.15.RELEASE-API文档-中文版.zip

    赠送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-...

    spring-security-core-5.3.9.RELEASE-API文档-中文版.zip

    赠送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依赖信息文件:...

    maven-compiler-plugin-3.8.0-source-release插件

    &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;3.8.0&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.8&lt;/source&gt; &lt;!-- 指定源代码兼容的JDK版本 --&gt; &lt;target&gt;1.8&lt;/target&gt; &lt;!-- 指定编译的目标JVM版本 --&gt; ...

    spring-session-core-2.0.5.RELEASE-API文档-中英对照版.zip

    赠送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依赖信息文件:...

    maven的优缺点 项目

    &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;encoding&gt;UTF-8&lt;/encoding&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; 3.6.生命周期 Maven -build...

    spring-plugin-metadata-2.0.0.RELEASE-API文档-中文版.zip

    赠送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依赖信息...

    spring-security-rsa-1.0.10.RELEASE-API文档-中文版.zip

    赠送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依赖信息文件:...

Global site tag (gtag.js) - Google Analytics