不能在我的Maven项目中使用依赖jboss-javaee-6.0

时间:2013-04-30 13:00:25

标签: maven ejb java-ee-6

我已经使用JBoss 7.1.1建立了一个maven项目,我想使用JavaEE库。 在我设置的根pom.xml中:

<repositories>
    <repository>
        <id>jboss</id>
        <url>https://repository.jboss.org/nexus/content/groups/public/</url>
    </repository>
</repositories>

我在root pom.xml和ejb maven模块的pom.xml中有这个:

<dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-6.0</artifactId>
        <version>3.0.2.Final</version>
        <scope>provided</scope>
        <type>pom</type>
</dependency>

当我执行maven clean install时,我收到此错误:

Failed to execute goal on project myproject-ejb: Could not resolve dependencies for project myproject:myproject-ejb:ejb:1.0-SNAPSHOT: Failure to find org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final in https://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss has elapsed or updates are forced -> [Help 1]

我的配置怎么了?

编辑1
如果我从root pom.xml中删除jboss存储库,我会收到此错误:

[ERROR] Failed to execute goal on project myproject-ejb: Could not resolve dependencies for project myproject:myproject-ejb:ejb:1.0-SNAPSHOT: The following artifacts could not be resolved: org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final, xalan:xalan:jar:2.7.1.jbossorg-2: Could not find artifact org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final in central (http://repo.maven.apache.org/maven2) -> [Help 1]

3 个答案:

答案 0 :(得分:10)

这是由Xalan POM文件中的bug引起的。以下workaround为我解决了问题:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-6.0</artifactId>
            <version>3.0.2.Final</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <!-- Required by jboss-javaee-6.0:3.0.2.Final (https://issues.jboss.org/browse/JBBUILD-708) --> 
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.7.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

答案 1 :(得分:0)

jboss-javaee-6.0的给定依赖关系可从Maven Central获得,因此无需提供单独的存储库。

根据错误消息,您需要从位置maven存储库中删除特定位置(通常位于$ HOME / .m2 / repository中),在这种情况下,文件夹为 org / jboss / 。之后你需要重建你的项目。

答案 2 :(得分:0)

这对我有用:

<dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-all-6.0</artifactId>
    <version>3.0.2.Final</version>
    <scope>provided</scope>
</dependency>

但我看到here以下内容也可能有效:

<dependency>    
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-web-6.0</artifactId>
    <version>2.0.0.Final</version>
    <type>pom</type>
    <scope>import</scope>    
</dependency>