我的目标是将一场战争纳入另一场战争。查看我的项目结构:
+test-parent (这里是 spring 和 hibernate 框架的所有常见依赖项) -- test-core (所有常见类类型的集合:jar) -- test-web (应该作为单独的 web 应用程序运行的 web 应用程序,依赖于 test -core, type:war) -- test-web-2 (依赖于 test-web,test-core, type:war 的 webapp)
我使用 Maven War 插件来实现这一点。
测试父/pom.xml
<?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>test-parent</groupId>
<artifactId>test-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>test-core</module>
<module>test-web</module>
<module>test-web-2</module>
</modules>
<dependencies>
<!-- All common spring & hibernate dependencies -->
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
测试核心/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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-parent</groupId>
<artifactId>test-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>test-core</artifactId>
</project>
Run Code Online (Sandbox Code Playgroud)
测试-web/pom.xml
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 …Run Code Online (Sandbox Code Playgroud)