2012-03-21 16 views
3

我已經完成了以下步驟:嘗試編譯mahout但出現錯誤 - 無法執行mojo:資源。建立未使用的pom.xml

  1. 安裝的Java 1.6
  2. 我使用Ubuntu 11.10。在/etc/bash.bachrc中添加了$ JAVA_HOME路徑
  3. 已安裝的maven。 mvn --version正在顯示已安裝的maven。
  4. 從網上下載http://svn.apache.org/repos/asf/mahout/trunk

現在亨利馬烏,我去象夫/行李箱內,並嘗試做mvn clean installmvn clean install -X -e,那麼它給follwoing錯誤 -

無法執行魔力:資源。它需要一個具有 pom.xml的項目,但構建不使用它。

我只是想嘗試在mahout/examples中的例子。如何解決這個錯誤?

該目錄中有一個pom.xml。

完全端子輸出是在這裏:

+ Error stacktraces are turned on. 
Apache Maven 2.2.1 (rdebian-6) 
Java version: 1.6.0_23 
Java home: /usr/lib/jvm/java-6-openjdk/jre 
Default locale: en_IN, platform encoding: UTF-8 
OS name: "linux" version: "3.0.0-16-generic" arch: "i386" Family: "unix" 
[DEBUG] Building Maven user-level plugin registry from: '/home/kartikeya/.m2/plugin-registry.xml' 
[DEBUG] Building Maven global-level plugin registry from: '/usr/share/maven2/conf/plugin-registry.xml' 
[INFO] Scanning for projects... 
[DEBUG] Wagons could not be registered as the extension container was never created 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Default Project 
[INFO] task-segment: [clean, install] 
[INFO] ------------------------------------------------------------------------ 
[DEBUG] Retrieving parent-POM: org.apache.maven.plugins:maven-plugins:pom:12 for project: null:maven-clean-plugin:maven-plugin:2.3 from the repository. 
[DEBUG] Retrieving parent-POM: org.apache.maven:maven-parent:pom:9 for project: org.apache.maven.plugins:maven-plugins:pom:12 from the repository. 
[DEBUG] Retrieving parent-POM: org.apache:apache:pom:4 for project: org.apache.maven:maven-parent:pom:9 from the repository. 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one. 
[INFO] ------------------------------------------------------------------------ 
[DEBUG] Trace 
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one. 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) 
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:616) 
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) 
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) 
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) 
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one. 
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:414) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694) 
    ... 17 more 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: < 1 second 
[INFO] Finished at: Wed Mar 21 11:32:36 IST 2012 
[INFO] Final Memory: 2M/55M 
[INFO] ------------------------------------------------------------------------ 
+0

您可以驗證有一個POM沒有的pom.xml。 xml在你正在運行的目錄「mvn clean install」? – aliasmrchips 2012-03-21 06:38:36

+0

是的,該目錄中有一個pom.xml。 – 2012-03-21 07:12:04

+1

安裝最新的maven 3.0.4,從〜/ .m2中刪除所有文件(或移動到其他位置)並重試。它適用於我 – 2012-03-21 07:30:24

回答

5

謝謝ajozwik和歐文。

我從aptitude安裝了maven2。我採取了以下措施來解決這個問題:

  1. 去掉Maven2的sudo apt-get remove maven2
  2. 安裝有Maven 3.0.4的Ubuntu中的指示 - Installing maven2 without openjdk

  3. 即使這樣做後,我得到了錯誤 -

    Unable to locate the javac Compiler in:[ERROR] /usr/lib/jvm/java-6-openjdk/jre/../lib/tools.jar

要解決此問題,需要重新安裝JDK。它爲我工作!對於那些甚至如果這種解決方案不起作用,請看看 - Why maven ignores my JAVA_HOME?

問候。

2

「無法執行魔力:資源它需要與現有的pom.xml的項目。」

此錯誤意味着在工作目錄

相關問題