- 1.首先在war模块B添加一个maven-jar-plugin,并设置其classifier为jar.
1 <plugin> 2 <groupId>org.apache.maven.plugins</groupId> 3 <artifactId>maven-jar-plugin</artifactId> 4 <version>2.4</version> 5 <configuration> 6 <classifier>jar</classifier> 7 </configuration> 8 <executions> 9 <execution> 10 <goals> 11 <goal>jar</goal> 12 </goals> 13 </execution> 14 </executions> 15 </plugin>
- 2.然后模块A引用模块B的jar文件
1 <dependency> 2 <groupId>${project.groupId}</groupId> 3 <artifactId>B</artifactId> 4 <version>${project.version}</version> 5 <classifier>jar</classifier> 6 <scope>runtime</scope> 7 </dependency>