Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile
2014-12-12 17:09
726 查看
1. 好坑呐,一个问题解决了好久才解决。终于可以了不容易啊。
跟着《Maven实战》学习第一个项目就出问题。Compile通过了,可是Test时有问题。网上报这个错的大部分用的都是Eclipse的。我用的Intellij IDEA。搞得好累。
(1)书上的配置时这样的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
结果报这个错误:
[WARNING] Some problems were encountered while building the effective model for com.jasminezhao.mvntest:hello-world:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 20, column 21
[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.
需要加上:<version>3.1</version>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>(2) 报下面的错误,
跟着《Maven实战》学习第一个项目就出问题。Compile通过了,可是Test时有问题。网上报这个错的大部分用的都是Eclipse的。我用的Intellij IDEA。搞得好累。
(1)书上的配置时这样的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
结果报这个错误:
[WARNING] Some problems were encountered while building the effective model for com.jasminezhao.mvntest:hello-world:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 20, column 21
[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.
需要加上:<version>3.1</version>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>(2) 报下面的错误,
[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[3,17] package org.junit does not exist [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[5,24] package org.junit does not exist [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[5,1] static import only from classes and interfaces [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[11,6] cannot find symbol symbol: class Test location: class HelloWorldTest [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[17,9] cannot find symbol symbol: method assertEquals(java.lang.String,java.lang.String) location: class HelloWorldTest [INFO] 5 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9.056 s [INFO] Finished at: 2014-12-11T17:50:50+08:00 [INFO] Final Memory: 11M/27M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project hello-world: Compilation failure: Compilation failure: [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[3,17] package org.junit does not exist [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[5,24] package org.junit does not exist [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[5,1] static import only from classes and interfaces [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[11,6] cannot find symbol [ERROR] symbol: class Test [ERROR] location: class HelloWorldTest [ERROR] /D:/Maven Hello World Project/src/test/java/HelloWorldTest.java:[17,9] cannot find symbol [ERROR] symbol: method assertEquals(java.lang.String,java.lang.String) [ERROR] location: class HelloWorldTest [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException[/code]发现External Libraries里面有junit 4.1.0 jar,但是发现项目还是哪里有一个junit 3.8.1 jar,我估计两个jar冲突了。把两个都删了,打算重新导入。结果在项目里点击下面的按钮都不能导入,后面把.m2(C:\Users\*\.m2\repository\junit\junit)下面的包删除了。在点击旁边的一个Event Log里面蓝色字体提示的也会帮助导入包。一直不知道怎么导入maven的jar包。
截图如下:
相关文章推荐
- 【maven install报错】Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
- maven Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-com
- Maven install报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
- 关于IDEA下出现Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 的解决方法
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ppcloud-common: Compilation failure
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法
- 解决maven install报错信息(Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile )
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-c
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) 解决方案
- maven 构建编译失败:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:
- maven报 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile(defalut-compile) on project 项目名称:No such compile 'javac'
- 针对Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1的解决方案
- 针对Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1的解决方案