无法使用org.wildfly构建Java EE项目:wildfly-spec-api依赖项

时间:2018-01-11 18:42:03

标签: java maven java-ee wildfly wildfly-10

我将Java EE 7应用程序部署到WildFly 10.1.0.Final

我有以下Maven配置:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>mycompany</groupId>
    <artifactId>payment</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>payment</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.bom</groupId>
                <artifactId>wildfly-javaee7-with-tools</artifactId>
                <version>10.1.0.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-spec-api</artifactId>
            <version>10.1.0.Final</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.12</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>4.0.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>20.0</version>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>3.0.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>1.10.19</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.graphene</groupId>
            <artifactId>graphene-webdriver</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wildfly.arquillian</groupId>
            <artifactId>wildfly-arquillian-container-remote</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>payment</finalName>
    </build>
</project>

我输入

mvn clean package

我收到以下错误

  

[INFO]   -------------------------------------------------- ----------------------下载:   https://repo.maven.apache.org/maven2/org/wildfly/wildfly-spec-api/10.1.0.Final/wildfly-spec-api-10.1.0.Final.jar   [信息]   -------------------------------------------------- ---------------------- [INFO] BUILD FAILURE [INFO]   -------------------------------------------------- ---------------------- [INFO]总时间:2.262 s [INFO]完成于:   2018-01-10T15:50:43 + 01:00 [信息]最终记忆:20M / 399M [INFO]   -------------------------------------------------- ---------------------- [错误]无法执行项目付款目标:无法解决   项目mycompany的依赖项:payment:war:1.0-SNAPSHOT:不能   找到工件org.wildfly:wildfly-spec-api:jar:10.1.0.Final in central   (https://repo.maven.apache.org/maven2) - &gt; [帮助1] [错误] [错误]收件人   看到错误的完整堆栈跟踪,用-e重新运行Maven   开关。 [ERROR]使用-X开关重新运行Maven以启用完全调试   日志记录。 [错误] [错误]有关错误和更多信息   可能的解决方案,请阅读以下文章:[错误] [帮助   1]   http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

如何修复项目?我不能使用javax:javaee-api依赖,因为当我使用它时IntelliJ行为不端。

1 个答案:

答案 0 :(得分:1)

感谢Federico Sierra的评论和WildFly JIRA的快速帮助,我知道我失踪了

<type>pom</type>

所以它应该是

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-spec-api</artifactId>
        <version>10.1.0.Final</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>