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

标签 java maven jakarta-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] ------------------------------------------------------------------------ Downloading: https://repo.maven.apache.org/maven2/org/wildfly/wildfly-spec-api/10.1.0.Final/wildfly-spec-api-10.1.0.Final.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.262 s [INFO] Finished at: 2018-01-10T15:50:43+01:00 [INFO] Final Memory: 20M/399M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project payment: Could not resolve dependencies for project mycompany:payment:war:1.0-SNAPSHOT: Could not find artifact org.wildfly:wildfly-spec-api:jar:10.1.0.Final in central (https://repo.maven.apache.org/maven2) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

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

最佳答案

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

关于java - 无法使用 org.wildfly 构建 Java EE 项目 :wildfly-spec-api dependency,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48213893/

相关文章:

java - native 查询可以使用 sqlDeveloper,但使用 hibernate 时失败

java - SessionInformation 过期不会导致用户从系统注销

java - IntelliJ 的一个 Maven 项目依赖于另一个 Maven 项目 : How to be efficient?

java - 从打包的 war 文件中排除本地 WEB-INF/lib jar

java - 在csv java上按列分隔元素

java - 如何指定特定的 JAXB 实现?

java - 为 WAR 文件强制自定义 ClassLoader?

java - 容器的投影,即将 List<Object> 转换为 List<Object.Member> 的方法

java - Struts2 记住我

java - Java 1.8 中并行流和顺序流的区别