标签:
错误一:
1.eclipse中, 当maven test的时候,报错:
-Dmaven.multiModuleProjectDirectory=$M2_HOME)
可以设一个环境变量M2_HOME指向你的maven安装目录 M2_HOME=D:\Apps\apache-maven-3.3.1 然后在Window->Preference->Java->Installed JREs->Edit 在Default VM arguments中设置 -Dmaven.multiModuleProjectDirectory=$M2_HOME
报错误2
错误2:
maven No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?解决办法:
在Window->Preference->Java->Installed JREs->Execution Environments选择JDK版本(1.7)
运行结果:
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building MavenLearning 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MavenLearning --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\all\eclipse432\MavenLearning\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MavenLearning --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MavenLearning --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\all\eclipse432\MavenLearning\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MavenLearning --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ MavenLearning --- [INFO] Surefire report directory: D:\all\eclipse432\MavenLearning\target\surefire-reports [INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom (3 KB at 0.6 KB/sec) [INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar (37 KB at 32.4 KB/sec) ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.xubo.maven.MavenLearning.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.051 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ MavenLearning --- [INFO] Building jar: D:\all\eclipse432\MavenLearning\target\MavenLearning-0.0.1-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ MavenLearning --- [INFO] Installing D:\all\eclipse432\MavenLearning\target\MavenLearning-0.0.1-SNAPSHOT.jar to D:\1win7\java\apache-maven-3.3.9-bin\Repository\org\xubo\maven\MavenLearning\0.0.1-SNAPSHOT\MavenLearning-0.0.1-SNAPSHOT.jar [INFO] Installing D:\all\eclipse432\MavenLearning\pom.xml to D:\1win7\java\apache-maven-3.3.9-bin\Repository\org\xubo\maven\MavenLearning\0.0.1-SNAPSHOT\MavenLearning-0.0.1-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.344 s [INFO] Finished at: 2016-05-09T20:28:03+08:00 [INFO] Final Memory: 13M/166M [INFO] ------------------------------------------------------------------------
参考
【1】http://fxb4632242.iteye.com/blog/2193945
【2】http://zhidao.baidu.com/link?url=jJVj6dw_0be5PdZrDR6m0PBjNhL3C6RbgfP89boI1mSbl2_eQ0qcK4Jp5aqEuxBdbbZ50kbJ3LEXFF5khyMZi_Nh_SJ1Vadnm-p3JkXmjy7
Maven学习4之eclipse下 maven install和test的两个错误
标签:
原文地址:http://blog.csdn.net/xubo245/article/details/51355791