2014-01-14 88 views
2

我打開了一個在我的大學制作的簡單(空白)項目來檢查Maven/Jetty是否工作。 雖然我已經安裝的Maven 3.1.1,它mvn -version下工作,當我運行該項目,我得到一個很長的錯誤:運行mvn碼頭時出錯:在OSX上運行

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3.949s 
[INFO] Finished at: Tue Jan 14 20:43:18 CET 2014 
[INFO] Final Memory: 13M/81M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.1.0.v20131115:run (default-cli) on project java2: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.1.0.v20131115:run failed: Unable to load the mojo 'run' in the plugin 'org.eclipse.jetty:jetty-maven-plugin:9.1.0.v20131115' 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.v20131115 
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 
[ERROR] urls[0] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.1.0.v20131115/jetty-maven-plugin-9.1.0.v20131115.jar 
[ERROR] urls[1] = file:/Users/Fengson/.m2/repository/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar 
[ERROR] urls[2] = file:/Users/Fengson/.m2/repository/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar 
[ERROR] urls[3] = file:/Users/Fengson/.m2/repository/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar 
[ERROR] urls[4] = file:/Users/Fengson/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar 
[ERROR] urls[5] = file:/Users/Fengson/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar 
[ERROR] urls[6] = file:/Users/Fengson/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar 
[ERROR] urls[7] = file:/Users/Fengson/.m2/repository/org/sonatype/aether/aether-util/1.11/aether-util-1.11.jar 
[ERROR] urls[8] = file:/Users/Fengson/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar 
[ERROR] urls[9] = file:/Users/Fengson/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar 
[ERROR] urls[10] = file:/Users/Fengson/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar 
[ERROR] urls[11] = file:/Users/Fengson/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar 
[ERROR] urls[12] = file:/Users/Fengson/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.1/maven-plugin-tools-api-3.1.jar 
[ERROR] urls[13] = file:/Users/Fengson/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar 
[ERROR] urls[14] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-util/9.1.0.v20131115/jetty-util-9.1.0.v20131115.jar 
[ERROR] urls[15] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-webapp/9.1.0.v20131115/jetty-webapp-9.1.0.v20131115.jar 
[ERROR] urls[16] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-xml/9.1.0.v20131115/jetty-xml-9.1.0.v20131115.jar 
[ERROR] urls[17] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-servlet/9.1.0.v20131115/jetty-servlet-9.1.0.v20131115.jar 
[ERROR] urls[18] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-jaas/9.1.0.v20131115/jetty-jaas-9.1.0.v20131115.jar 
[ERROR] urls[19] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-security/9.1.0.v20131115/jetty-security-9.1.0.v20131115.jar 
[ERROR] urls[20] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-plus/9.1.0.v20131115/jetty-plus-9.1.0.v20131115.jar 
[ERROR] urls[21] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-jndi/9.1.0.v20131115/jetty-jndi-9.1.0.v20131115.jar 
[ERROR] urls[22] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-server/9.1.0.v20131115/jetty-server-9.1.0.v20131115.jar 
[ERROR] urls[23] = file:/Users/Fengson/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar 
[ERROR] urls[24] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-http/9.1.0.v20131115/jetty-http-9.1.0.v20131115.jar 
[ERROR] urls[25] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-io/9.1.0.v20131115/jetty-io-9.1.0.v20131115.jar 
[ERROR] urls[26] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-jmx/9.1.0.v20131115/jetty-jmx-9.1.0.v20131115.jar 
[ERROR] urls[27] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-annotations/9.1.0.v20131115/jetty-annotations-9.1.0.v20131115.jar 
[ERROR] urls[28] = file:/Users/Fengson/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar 
[ERROR] urls[29] = file:/Users/Fengson/.m2/repository/org/ow2/asm/asm/4.1/asm-4.1.jar 
[ERROR] urls[30] = file:/Users/Fengson/.m2/repository/org/ow2/asm/asm-commons/4.1/asm-commons-4.1.jar 
[ERROR] urls[31] = file:/Users/Fengson/.m2/repository/org/ow2/asm/asm-tree/4.1/asm-tree-4.1.jar 
[ERROR] urls[32] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.1.0.v20131115/javax-websocket-server-impl-9.1.0.v20131115.jar 
[ERROR] urls[33] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.1.0.v20131115/javax-websocket-client-impl-9.1.0.v20131115.jar 
[ERROR] urls[34] = file:/Users/Fengson/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar 
[ERROR] urls[35] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.1.0.v20131115/websocket-server-9.1.0.v20131115.jar 
[ERROR] urls[36] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.1.0.v20131115/websocket-common-9.1.0.v20131115.jar 
[ERROR] urls[37] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.1.0.v20131115/websocket-api-9.1.0.v20131115.jar 
[ERROR] urls[38] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.1.0.v20131115/websocket-client-9.1.0.v20131115.jar 
[ERROR] urls[39] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.1.0.v20131115/websocket-servlet-9.1.0.v20131115.jar 
[ERROR] urls[40] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/jetty-jsp/9.1.0.v20131115/jetty-jsp-9.1.0.v20131115.jar 
[ERROR] urls[41] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/toolchain/jetty-schemas/3.1.M0/jetty-schemas-3.1.M0.jar 
[ERROR] urls[42] = file:/Users/Fengson/.m2/repository/javax/servlet/jsp/javax.servlet.jsp-api/2.3.1/javax.servlet.jsp-api-2.3.1.jar 
[ERROR] urls[43] = file:/Users/Fengson/.m2/repository/org/glassfish/web/javax.servlet.jsp/2.3.2/javax.servlet.jsp-2.3.2.jar 
[ERROR] urls[44] = file:/Users/Fengson/.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[45] = file:/Users/Fengson/.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[46] = file:/Users/Fengson/.m2/repository/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar 
[ERROR] urls[47] = file:/Users/Fengson/.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[48] = file:/Users/Fengson/.m2/repository/org/eclipse/jetty/orbit/javax.activation/1.1.0.v201105071233/javax.activation-1.1.0.v201105071233.jar 
[ERROR] urls[49] = file:/Users/Fengson/.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]] 
[ERROR] 
[ERROR] ----------------------------------------------------- 
[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/PluginContainerException 

我缺少什麼?

+0

你可以發佈你的POM? –

回答

2

好吧,我得到它的工作。看起來Maven使用的是Java 1.6而不是1.7。 我打開終端,做:

cd /usr/local/Cellar/maven/3.1.1/libexec/bin/ 

然後編輯mvn文件:

open -e mvn 

,並將此開頭:

export JAVA_HOME=$(/usr/libexec/java_home) 

這是默認的Java目錄OSX。 之後,它工作得很好。

我沒有看到Andrey Chaschev的答案,但它似乎指出了同樣的問題,所以我會接受這個答案。謝謝,安德烈!

3

版51對應於JDK 7下面的消息中:

org/eclipse/jetty/maven/plugin/JettyRunMojo: Unsupported major.minor version 51.0 

好像碼頭9是建立與JDK 7與源設置爲1.7。你可以嘗試安裝JDK 7來運行它。

相關問題