maven报 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile(defalut-compile) on project 项目名称:No such compile 'javac'
这个问题纠结了一天,在另外一个电脑是正常的,但是从服务器下载下来到另外一个电脑的时候却出现了如下图问题
看到javac大家都会想到是编译出现问题,而本地的配置如下图所示:
看着配置都是一致的,会是哪里的问题呢?经网上咨询有个大神说是可能是maven没有配置指定的jdk原因,原因如下:
maven是个项目管理工具,如果我们不告诉它我们的代码要使用什么样的jdk版本编译的话,它就会用maven-compiler-plugin默认的jdk版本来进行处理,这样就容易出现版本不匹配的问题,以至于可能导致编译不通过的问题。为了处理这一种情况的出现,在构建maven项目的时候,我习惯性第一步就是配置maven-compiler-plugin插件。解决办法:
在pom.xml中指定使用的版本 1 <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- 使用3.5.1也是正确 不知道为啥 如果是3.0就是错误的,但是maven里面也有3.0的版本,可能跟我电脑安装的maven版本有关,本地按照maven版本为3.0.5 -->
<version>3.1</version>
<configuration>
<defaultLibBundleDir>lib</defaultLibBundleDir>
指定高版本的源码和编译后的字节码文件
<source>1.6</source>
<target>1.6</target>
<optimize>true</optimize>
<debug>true</debug>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<encoding>UTF-</encoding>
</configuration>
</plugin> </plugins>
</build>
经过指定后,电脑可以正常运行了。
问题2:
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.xxx.xxx:xxxx:jar:0.0.-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line , column
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
对照官网用法:http://maven.apache.org/plugins/maven-compiler-plugin/usage.html
起初配置:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-</encoding>
</configuration>
</plugin>
</plugins>
该问题解决办法是需要置顶maven版本,解决办法:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-</encoding>
</configuration>
</plugin>
</plugins>
maven报 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile(defalut-compile) on project 项目名称:No such compile 'javac'的更多相关文章
- maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang
maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default- ...
- 【maven】Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site)
问题描述 site一点击就报错,如下 Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (defau ...
- Maven错误“Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create ”解决
用maven3新建一个项目时,输入的命令如下: mvn archetype:create 出现错误如下: [ERROR] Failed to execute goal org.apache.maven ...
- Maven打包时报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:解决方案
问题现象: 用Maven打包时,报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war错误. 原因分析: 打 ...
- [转]maven打包报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test
源文URL:http://blog.csdn.net/caiwenfeng_for_23/article/details/44514947 mvn compile 没有问题,mvn package的 ...
- maven打包报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test
mvn package的时候报如下错误: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test ...
- Maven进行install的时候报错,COMPILATION ERROR : Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project cmu: There are test failures.
maven进行install的时候,test类里面报错: COMPILATION ERROR : [INFO] -------------------------------------------- ...
- git 打包报错:Maven Build时提示:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test
1.使用git 升级 服务命令 mvn deploy -e 之后报错: Failed to execute goal org.apache.maven.plugins:maven-surefire- ...
- mvn install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2 错误: 找不到符号
报错信息 在Eclipse中执行mvn install时,console端显示如下报错信息: [ERROR] Failed to execute goal org.apache.maven.plugi ...
随机推荐
- 如何使用单例模式返回一个安全的Connection
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public clas ...
- IDEA的安装
https://blog.csdn.net/when_to_return/article/details/81590356
- web中icon 图标问题
每个页面都会引入 icon 小图标,下面说下它的用法 一.icon使用 icon的引入方式,与css外部引入方式类似,需要在头部引入, 即: <link rel="shortcut i ...
- bootstrap学习总结
bootstrap网站下载: 谷歌浏览器访问:http://github.com/twbs/bootstrap/ 右上角(clone or download) 编译版bootstrap:http ...
- netty4.0 Server和Client的通信
netty4.0 Server和Client的通信 创建一个maven项目 添加Netty依赖 <dependency> <groupId>io.netty</group ...
- 20180821 Python学习笔记:如何获取当前程序路径
20180821 Python学习笔记:如何获取当前程序路径 启动的脚本的路径为:D:\WORK\gitbase\ShenzhenHouseInfoCrawler\main.py 当前脚本的路径为:D ...
- vs 2017 community中文版下载地址
https://my.visualstudio.com/Downloads?pid=2190 SHA1: 109C6646A79844D8116DADB293A0B64754363C69 File n ...
- Tone Mapping算法系列二:一种自适应对数映射的高对比度图像显示技术及其速度优化。
办公室今天停电,幸好本本还有电,同事们好多都去打麻将去了,话说麻将这东西玩起来也还是有味的,不过我感觉我是输了不舒服,赢了替输的人不舒服,所以干脆拜别麻坛四五年了,在办公室一个人整理下好久前的一片论文 ...
- intellj idea 跑覆盖率
- HDU 1022.Train Problem I【栈的应用】【8月19】
Train Problem I Problem Description As the new term comes, the Ignatius Train Station is very busy n ...