【发布时间】:2017-10-13 19:19:23
【问题描述】:
我有一个带有以下 pom.xml 的项目,并且我已经从中删除了一些不需要的东西。我打算生成一个 jar 文件并最终生成一个 war 包,其中包含 jar 文件作为库。不幸的是,以下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>
<artifactId>test</artifactId>
<groupId>com.test.abcd</groupId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test Application</name>
....
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>target/www/</warSourceDirectory>
</configuration>
<executions>
<execution>
<id>build-war-in-classes</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</project>
尽管这会在打包阶段同时生成 jar 和 war,但 war 不包含 jar 文件 (WEB-INF/lib/test-0.0.1-SNAPSHOT.jar) 作为库,而是我看到以下类,
META-INF/
META-INF/MANIFEST.MF
....
WEB-INF/
WEB-INF/classes/
....
什么可能导致这种行为?
【问题讨论】: