使用maven-shade-plugin我正在尝试创建一个项目文件结构,如下所示:
问题是下面的 pom 配置没有创建 WEB-INF 目录。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<createDependencyReducedPom>true</createDependencyReducedPom>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.my.package.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
基本上我需要将我的 web.xml 文件、类和 lib 文件复制到项目根目录中名为 WEB-INF 的目录中。
更新:对不起,我从我的 pom 复制了错误的插件到原始问题中!
更新:如果我从 pom 声明中添加包装:<packaging>war</packaging>
WEB-INF 文件结构按照 OQ 完成。但是,有了这个声明,com
目录现在不包含我的包,所以找不到主类。
它看起来如何<packaging>war</packaging>
:
它应该看起来如何: