2012-10-30 128 views
1

在運行mvn install glassfish:deploy我碰到以下問題的maven-與GlassFish插件在Maven的3.0.4

[...] 
[ERROR] Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy (default-cli) on project post-build-pom: Execution default-cli of goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy failed: Plugin o rg.glassfish.maven.plugin:maven-glassfish-plugin:2.1 or one of its dependencies could not be resolved: Failed to collect dependencies for org.glassfish.maven.plugin:maven-glassfish-plugin:jar:2.1(): Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:3.0-SONATYPE-688946: Failure to find org.apache.maven:maven-parent:pom:9-SNAPSHOT in http://maven-repository/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of internal-repository has elapsed or updates are forced -> [Help 1] 
[...] 

mvn -v看起來是這樣的:

Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100) Maven home: C:\Users\rob\apache-maven-3.0.4\bin\.. Java version: 1.6.0_37, vendor: Sun Microsystems Inc. Java home: C:\Programme\Java\jdk1.6.0_37\jre Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Futhermore我的Nexus-庫在http://maven-repository上運行。

編輯:插件部分從pom.xml的是這樣的:

<plugin> 
    <groupId>org.glassfish.maven.plugin</groupId> 
    <artifactId>maven-glassfish-plugin</artifactId> 
    <version>2.1</version> 
    <configuration> 
     <user>admin</user> 
     <adminPassword>adminadmin</adminPassword> 
     <glassfishDirectory>c:\development\glassfish-v2.1.1-b31g</glassfishDirectory> 
    </configuration> 
</plugin> 
+1

您可以發佈post-build-pom.pom嗎? –

回答

2

你不在面臨的問題有唯一一個:)

似乎是官方的,甚至錯誤報告那麼:http://java.net/jira/browse/GLASSFISH-14411

作爲這裏建議的解決方法:http://jira.codehaus.org/browse/MNG-4843 你應該用正確的版本覆蓋項目中的插件依賴項。

以下應該解決您的問題:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.glassfish.maven.plugin</groupId> 
      <artifactId>maven-glassfish-plugin</artifactId> 
      <version>2.1</version> 
      <configuration> 
       <user>admin</user> 
       <adminPassword>adminadmin</adminPassword> 
       <glassfishDirectory>c:\development\glassfish-v2.1.1-b31g</glassfishDirectory> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
<dependencies> 
    <dependency> 
     <groupId>org.apache.maven</groupId> 
     <artifactId>maven-project</artifactId> 
     <version>3.0-alpha-2</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.maven</groupId> 
     <artifactId>maven-plugin-api</artifactId> 
     <version>3.0.4</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.maven</groupId> 
     <artifactId>maven-artifact</artifactId> 
     <version>3.0.4</version> 
     <scope>provided</scope> 
    </dependency> 
</dependencies> 

當然,你需要提供所需的全部配置,但它是通過覆蓋另一個話題:http://maven-glassfish-plugin.java.net/examples/complete.html

+2

只爲其他人可能不會找到這個地方,我添加了解決方法,以正式的錯誤報告以及:) –

+1

嗨,彼得,非常感謝您的答案。我藉助所提供的信息重新配置了我的項目,現在它就可以工作了。 – Rob

2

我找到另一種方式來解決這個問題:

  1. 複製文件「C:\ Users \ <當前用戶> \。m2 \ repository \ org \ apache \ maven \ maven-parent \ 11 \ maven-parent-11.pom」 到 「C:\用戶\ <當前用戶> \平方米\庫\組織\阿帕奇\行家\行家父\ 11-SNAPSHOT \」

  2. 和重命名爲「行家父-11- SNAPSHOT.pom「

+0

有趣的方法;將盡快進行測試。 – Rob

+0

沒有爲我工作。 – tomas789