使用SpringBoot模块创建EAR项目

问题描述

我需要创建一个EAR文件以部署在JBoss EAP 7上。我考虑过要建立一个如下的项目结构:

- rootproject
  -- ear (ear)
  -- web (war)

因此,对于rootproject,我使用以下.pom.xml创建了一个新的Simple Maven项目(使用Eclipse 06/2020):

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>jboss_test</groupId>
 <artifactId>jboss_test</artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <packaging>pom</packaging>
 <name>jboss_ear_test</name>

 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.11.RELEASE</version>
 </parent>

 <profiles>
  <profile>
    <id>default</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <modules>
        <module>ear</module>
        <module>web</module>
    </modules>
  </profile>
 </profiles>

</project>

因此,在其中,我使用以下SpringBoot 2.2.11创建了一个.pom.xml项目(WEB):

....
....
<parent>
    <artifactId>jboss_test</artifactId>
    <groupId>jboss_test</groupId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>web</artifactId>
<packaging>war</packaging>
<name>web-test</name>
<description>Spring Boot JBOSS</description>

.... // some dependencies

Maven模块将耳朵与以下.pom.xml配合使用:

....
....
<parent>
    <artifactId>jboss_test</artifactId>
    <groupId>jboss_test</groupId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>ear</artifactId>
<packaging>ear</packaging>
<name>ear-test</name>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <finalName>JBOSS-TEST_EAR</finalName>
                <version>6</version>
                <defaultLibBundleDir>lib</defaultLibBundleDir>
                <modules>
                    <webModule>
                        <groupId>jboss_test</groupId>
                        <artifactId>web</artifactId>
                        <bundleFileName>JBOSS-TEST.war</bundleFileName>
                        <contextRoot>/TEST</contextRoot>
                    </webModule>
                </modules>
           </configuration>
      </plugin>
   </plugins>
</build>

当我尝试从根目录构建项目时,出现以下错误:

Artifact[war:jboss_test:web] is not a dependency of the project

您能帮我找出问题所在吗?

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)