Maven 使用jetty 常见三个 错误

来源:互联网 发布:海关进出口数据查询 编辑:程序博客网 时间:2024/06/14 21:09

错误1:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project clothing: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre7\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
[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/conflu

jdk的问题,修改项目jdk引用到我们配置的 C盘中的jdk1.7路径,然后一切正常


错误2:

在eclipse中的goal中使用jetty:run命令报错

No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.mave

解决方法:在setting.xml中添加

  <pluginGroups>

    <pluginGroup>org.eclipse.jetty</pluginGroup>  

  </pluginGroups>

然后就可以使用jetty:run前缀 运行jetty了


错误3:

maven版本太低我使用3.0.5 ,jdk版本太低 我使用的jetty-maven-plugin版本为9.4.3是需要jdk1.8的  而我的是1.7 所以启动的时候也一直报错, 后来我改成maven 最新版3.5.0且将jetty-maven-plugin版本降为9.2.18 就可以了



总结一下:1、是eclipse 中jdk设置不对  

2、在setting.xml在中未在pluginGroups标签中添加<pluginGroup>jetty-maven-plugin的插件Id</pluginGroup>导致

在eclipse中无法在goal中使用jetty前缀 进行jetty:run启动项目

3、jdk版本,maven版本还有插件版本不符而引起的, 一般jetty插件版本有不同的jdk版本要求 和maven版本要求


http://www.eclipse.org/jetty/download.html


0 0
原创粉丝点击