Maven in multimodule web project: how to put sibling modules output to WEB-INF/classes and not into WEB-INF/lib as JARs?

依然范特西╮ 提交于 2019-12-05 16:19:28

You could use an overlay, although that requires that the sibling be of type war rather than jar. There's also using the dependency plugin to unpack the jar, but it will only unpack the version in your local repository, not the one you just packaged.

As for your 'more general' question, there's the excludes tag for the jar plugin.

In case if somebody is interested, I found this solution. I had exactly the same issue.

            <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <packagingExcludes>WEB-INF/lib/MYPACKAGE_TO_EXCLUDE.jar</packagingExcludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>unpack-MYPACKAGE_TO_EXCLUDE</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>${project.groupId}</groupId>
                                        <artifactId>MYPACKAGE_TO_EXCLUDE</artifactId>
                                        <version>${project.version}</version>
                                        <type>jar</type>
                                        <outputDirectory>${project.build.directory}/classes
                                </outputDirectory>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!