Error with mvn+jetty: Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:

女生的网名这么多〃 提交于 2019-12-08 07:26:29

问题


I get a weird error when I try to run mvn jetty:run on my project. Everything works fine when I run my code on another system, but on my mac I get this weird error. It has worked before, but suddenly it won't work.

This is the error message:

[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.1.0.M0:run (default-cli) on project assignment2-gui: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.1.0.M0:run failed: Unable to load the mojo 'run' in the plugin 'org.eclipse.jetty:jetty-maven-plugin:9.1.0.M0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/eclipse/jetty/maven/plugin/JettyRunMojo : Unsupported major.minor version 51.0
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.eclipse.jetty:jetty-maven-plugin:9.1.0.M0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.1.0.M0/jetty-maven-plugin-9.1.0.M0.jar
[ERROR] urls[1] = file:/Users/eivindml/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar
[ERROR] urls[2] = file:/Users/eivindml/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar
[ERROR] urls[3] = file:/Users/eivindml/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar
[ERROR] urls[4] = file:/Users/eivindml/.m2/repository/org/sonatype/aether/aether-util/1.11/aether-util-1.11.jar
[ERROR] urls[5] = file:/Users/eivindml/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[6] = file:/Users/eivindml/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[7] = file:/Users/eivindml/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[8] = file:/Users/eivindml/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[9] = file:/Users/eivindml/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.1/maven-plugin-tools-api-3.1.jar
[ERROR] urls[10] = file:/Users/eivindml/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[11] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-util/9.1.0.M0/jetty-util-9.1.0.M0.jar
[ERROR] urls[12] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-webapp/9.1.0.M0/jetty-webapp-9.1.0.M0.jar
[ERROR] urls[13] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-xml/9.1.0.M0/jetty-xml-9.1.0.M0.jar
[ERROR] urls[14] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-servlet/9.1.0.M0/jetty-servlet-9.1.0.M0.jar
[ERROR] urls[15] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-jaas/9.1.0.M0/jetty-jaas-9.1.0.M0.jar
[ERROR] urls[16] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-security/9.1.0.M0/jetty-security-9.1.0.M0.jar
[ERROR] urls[17] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-plus/9.1.0.M0/jetty-plus-9.1.0.M0.jar
[ERROR] urls[18] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-jndi/9.1.0.M0/jetty-jndi-9.1.0.M0.jar
[ERROR] urls[19] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-server/9.1.0.M0/jetty-server-9.1.0.M0.jar
[ERROR] urls[20] = file:/Users/eivindml/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
[ERROR] urls[21] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-http/9.1.0.M0/jetty-http-9.1.0.M0.jar
[ERROR] urls[22] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-io/9.1.0.M0/jetty-io-9.1.0.M0.jar
[ERROR] urls[23] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-jmx/9.1.0.M0/jetty-jmx-9.1.0.M0.jar
[ERROR] urls[24] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-annotations/9.1.0.M0/jetty-annotations-9.1.0.M0.jar
[ERROR] urls[25] = file:/Users/eivindml/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar
[ERROR] urls[26] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/orbit/org.objectweb.asm/3.1.0.v200803061910/org.objectweb.asm-3.1.0.v200803061910.jar
[ERROR] urls[27] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.1.0.M0/javax-websocket-server-impl-9.1.0.M0.jar
[ERROR] urls[28] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.1.0.M0/javax-websocket-client-impl-9.1.0.M0.jar
[ERROR] urls[29] = file:/Users/eivindml/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar
[ERROR] urls[30] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.1.0.M0/websocket-server-9.1.0.M0.jar
[ERROR] urls[31] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.1.0.M0/websocket-common-9.1.0.M0.jar
[ERROR] urls[32] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.1.0.M0/websocket-api-9.1.0.M0.jar
[ERROR] urls[33] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.1.0.M0/websocket-client-9.1.0.M0.jar
[ERROR] urls[34] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.1.0.M0/websocket-servlet-9.1.0.M0.jar
[ERROR] urls[35] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/jetty-jsp/9.1.0.M0/jetty-jsp-9.1.0.M0.jar
[ERROR] urls[36] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/toolchain/jetty-schemas/3.1.M0/jetty-schemas-3.1.M0.jar
[ERROR] urls[37] = file:/Users/eivindml/.m2/repository/javax/servlet/jsp/javax.servlet.jsp-api/2.3.1/javax.servlet.jsp-api-2.3.1.jar
[ERROR] urls[38] = file:/Users/eivindml/.m2/repository/org/glassfish/web/javax.servlet.jsp/2.3.2/javax.servlet.jsp-2.3.2.jar
[ERROR] urls[39] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/orbit/javax.servlet.jsp.jstl/1.2.0.v201105211821/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar
[ERROR] urls[40] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/orbit/org.apache.taglibs.standard.glassfish/1.2.0.v201112081803/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar
[ERROR] urls[41] = file:/Users/eivindml/.m2/repository/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar
[ERROR] urls[42] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/orbit/org.eclipse.jdt.core/3.8.2.v20130121/org.eclipse.jdt.core-3.8.2.v20130121.jar
[ERROR] urls[43] = file:/Users/eivindml/.m2/repository/org/eclipse/jetty/orbit/javax.activation/1.1.0.v201105071233/javax.activation-1.1.0.v201105071233.jar
[ERROR] urls[44] = file:/Users/eivindml/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

So there is probably something wrong with my setup on my mac, but it has worked before, and I can't say I have changed anything since the last time it worked. The only thing I can come up with, is that I removed and installed postgres with brew.


回答1:


I found the solution.

I actually was the installation of postgres with brew that broke it. brew intall postgres also installs a newer version of maven, but this had set the java version to 1.6. So I did brew remove maven, and when I now run mvn --version it gives me:

Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: /usr/share/maven
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

And everything works as it should. :)



来源:https://stackoverflow.com/questions/19317995/error-with-mvnjetty-failed-to-execute-goal-org-eclipse-jettyjetty-maven-plugi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!