【问题标题】:maven-glassfish-plugin in maven-3.0.4maven-3.0.4 中的 maven-glassfish-plugin
【发布时间】:2012-10-30 11:51:00
【问题描述】:

在运行mvn install glassfish:deploy 时遇到以下问题

[...]
[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"

此外,我的 nexus-repository 在 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>

【问题讨论】:

  • 你能发布 post-build-pom.pom 吗?

标签: maven-3 glassfish-2.x maven-glassfish-plugin


【解决方案1】:

你不是那里唯一面临问题的人:)

似乎甚至有官方的错误报告: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. 复制文件“C:\Users\\.m2\repository\org\apache\maven\maven-parent\11\maven-parent-11.pom” 到 "C:\Users\\.m2\repository\org\apache\maven\maven-parent\11-SNAPSHOT\"

  2. 并将其重命名为“maven-parent-11-SNAPSHOT.pom”

【讨论】:

  • 有趣的方法;很快就会对此进行测试。
猜你喜欢
  • 2010-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-09-29
相关资源
最近更新 更多