我正在开发一个 Maven 多模块应用程序,它由两个模块组成:
- 常见的
Webapp 我的项目结构如下:
-(root)pom -Common -Webapp
我们正在使用带有 S2I(源到映像)部署的 openshift Web 控制台。我们选择的图像是 Jboss Eap。提供 git 存储库后,Openshift 开始创建所需的资源。它使用 maven 成功编译和安装了我们的模块,但是它没有将它部署在 Jboss 的独立文件夹中。查看构建日志,我们可以在日志末尾检查所有正在检索的依赖项和构建成功。但是没有在图像 jboss 文件夹上部署工件。我们可以通过查看日志或使用控制台检查 pod 文件来确认这一点。
这个项目在 bitbucket 上
根 pom.xml
<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>
<groupId>com.test.parent</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>:: Parent ::</name>
<description>Parent POM for some app</description>
<modules>
<module>Common</module>
<module>Webapp</module>
</modules>
</project>
常见的pom:
<?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>
<parent>
<groupId>com.test.parent</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.test.common</groupId>
<artifactId>Common</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Common module</name>
<description>Module for common elements that exist between projects</description>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- Compiler plugin enforces Java 1.8 compatibility and activates annotation
processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
...
</dependencies>
</project>
最后,网络 pom:
<?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>
<parent>
<groupId>com.test.parent</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.test.external</groupId>
<artifactId>Webapp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name> Web</name>
<description>web module</description>
<properties>
<!-- Explicitly declaring the source encoding eliminates the following
message: -->
<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
<version.jboss.spec.javaee.7.0>1.0.3.Final</version.jboss.spec.javaee.7.0>
<!-- other plug-in versions -->
<version.war.plugin>2.1.1</version.war.plugin>
<!-- maven-compiler-plugin -->
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<build>
<!-- Set the name of the WAR, used as the context root when the app
is deployed -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
...
<dependency>
<groupId>com.test.common</groupId>
<artifactId>Common</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
</project>
有没有人设法做到这一点?