Cannot use dependency jboss-javaee-6.0 in my Maven project

只愿长相守 提交于 2020-01-23 11:45:10

问题


I have set up a maven project with JBoss 7.1.1 and I want to use JavaEE libraries. In the root pom.xml I have set:

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

I have this in the root pom.xml and and in the ejb maven module´s 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>

When I do a maven clean install I get this error:

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]

What´s up with my configuration?

EDIT 1
If I remove the jboss repository from the root pom.xml I get this error:

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

回答1:


This is caused by a bug in Xalan POM file. The following workaround fixed the problem for me:

<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>



回答2:


The given dependency for jboss-javaee-6.0 is available from Maven Central so there is no need to give a separate repository.

Based on the error message you need to delete a particular location from your location maven repository (usually in $HOME/.m2/repository) in this case the folder org/jboss/. Afterwards you need to rebuild your project.




回答3:


This worked for me:

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

But I see here that something like the following may also work:

<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>


来源:https://stackoverflow.com/questions/16300544/cannot-use-dependency-jboss-javaee-6-0-in-my-maven-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!