首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wildfly 10 Java EE EAR项目中缺少工件错误

Wildfly 10 Java EE EAR项目中缺少工件错误
EN

Stack Overflow用户
提问于 2017-02-02 12:13:21
回答 1查看 554关注 0票数 0

我使用向导创建了一个Java EE EAR项目。我在ear和web子项目的pom文件中都有一个错误。ejb pom文件没有错误。

这就是我得到的错误...

缺少工件org.jboss.ejb3:jboss-ejb3-web:war:1.0.0

下面是ear子项目的pom文件

代码语言:javascript
复制
<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>jboss-ejb3</artifactId>
        <groupId>org.jboss.ejb3</groupId>
        <version>1.0.0</version>
    </parent>

    <artifactId>jboss-ejb3-ear</artifactId>
    <packaging>ear</packaging>

    <name>jboss-ejb3: EAR Module</name>

    <url>http://wildfly.org</url>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>

    <dependencies>

        <!-- Depend on the ejb module and war so that we can package them -->
        <dependency>
            <groupId>org.jboss.ejb3</groupId>
            <artifactId>jboss-ejb3-web</artifactId>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>org.jboss.ejb3</groupId>
            <artifactId>jboss-ejb3-ejb</artifactId>
            <type>ejb</type>
        </dependency>
    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>${version.ear.plugin}</version>
                <configuration>
                    <!-- Tell Maven we are using Java EE 7 -->
                    <version>7</version>
                    <!-- Use Java EE ear libraries as needed. Java EE ear libraries 
                        are in easy way to package any libraries needed in the ear, and automatically 
                        have any modules (EJB-JARs and WARs) use them -->
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <fileNameMapping>no-version</fileNameMapping>
                </configuration>
            </plugin>
            <!-- The WildFly plugin deploys your ear to a local WildFly container -->
            <!-- Due to Maven's lack of intelligence with EARs we need to configure 
                the wildfly maven plugin to skip deployment for all modules. We then enable
                it specifically in the ear module. -->
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <configuration>
                    <filename>${project.artifactId}.ear</filename>
                    <skip>false</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
            <!-- Use this profile for any OpenShift specific customization your app will need. -->
            <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
            <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
            <id>openshift</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-ear-plugin</artifactId>
                        <version>${version.ear.plugin}</version>
                        <configuration>
                            <outputDirectory>deployments</outputDirectory>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>

下面是web子项目的pom文件。

代码语言:javascript
复制
<?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/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <artifactId>jboss-ejb3</artifactId>
      <groupId>org.jboss.ejb3</groupId>
      <version>1.0.0</version>
   </parent>

   <artifactId>jboss-ejb3-web</artifactId>
   <packaging>war</packaging>

   <name>jboss-ejb3: WAR Module</name>

   <url>http://wildfly.org</url>
   <licenses>
      <license>
         <name>Apache License, Version 2.0</name>
         <distribution>repo</distribution>
         <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
      </license>
   </licenses>

   <dependencies>

      <!-- Dependency on the EJB module so we can use it's services if needed -->
      <dependency>
         <groupId>org.jboss.ejb3</groupId>
         <artifactId>jboss-ejb3-ejb</artifactId>
         <type>ejb</type>
         <scope>provided</scope>
      </dependency>

      <!-- Import the JAX-RS API, we use provided scope as the API is included in JBoss WildFly -->
      <dependency>
         <groupId>org.jboss.resteasy</groupId>
         <artifactId>jaxrs-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <!-- Import the CDI API, we use provided scope as the API is included in JBoss WildFly -->
      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <!-- Import the JSF API, we use provided scope as the API is included in JBoss WildFly -->
      <dependency>
         <groupId>org.jboss.spec.javax.faces</groupId>
         <artifactId>jboss-jsf-api_2.2_spec</artifactId>
         <scope>provided</scope>
      </dependency>

      <!-- Import the JPA API, we use provided scope as the API is included in JBoss WildFly -->
      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <scope>provided</scope>
      </dependency>

       <!-- JSR-303 (Bean Validation) Implementation -->
       <!-- Provides portable constraints such as @Email -->
       <!-- Hibernate Validator is shipped in JBoss WildFly -->
       <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-validator</artifactId>
           <scope>provided</scope>
           <exclusions>
               <exclusion>
                   <groupId>org.slf4j</groupId>
                   <artifactId>slf4j-api</artifactId>
               </exclusion>
           </exclusions>
       </dependency>

   </dependencies>

   <build>
      <finalName>${project.artifactId}</finalName>
      <plugins>
         <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>${version.war.plugin}</version>
            <configuration>
               <!-- Java EE 7 doesn't require web.xml, Maven needs to catch up! -->
               <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
         </plugin>
      </plugins>
   </build>

</project>

错误发生在pom文件的这个区域。

代码语言:javascript
复制
  <dependency>
     <groupId>org.jboss.ejb3</groupId>
     <artifactId>jboss-ejb3-ejb</artifactId>
     <type>ejb</type>
     <scope>provided</scope>
  </dependency>

如何解决此错误?

EN

回答 1

Stack Overflow用户

发布于 2017-02-02 21:44:19

您的父pom文件中必须有模块部分,并确保依赖项按顺序排列在依赖项下。

代码语言:javascript
复制
    <modules>
        <module>core-module</module>
        <module>depends-on-core</module>
        <module>depends-on-core2</module>
        <module>depends-on-depends-on-core</module>
    </modules>

在安排更新maven之后。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41994072

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档