如何使用类路径资源配置Maven插件?
今天,我像这样配置Maven war插件:如何使用类路径资源配置Maven插件?,maven,Maven,今天,我像这样配置Maven war插件: <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webXml>${basedir}/../common/WEB-INF/web.xml</webXml> </configuration> org
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>${basedir}/../common/WEB-INF/web.xml</webXml>
</configuration>
org.apache.maven.plugins
maven战争插件
${basedir}/./common/WEB-INF/WEB.xml
这允许我在多个项目之间共享web.xml。
这种方法的问题在于我的Maven项目不是自包含的。它取决于文件系统上的相对路径
这样做有可能吗
<webXml>classpath:com/mycompany/common/web.xml</webXml>
<webXml>classpath:com/mycompany/common/web.xml</webXml>
classpath:com/mycompany/common/web.xml
当然,在插件的类路径上提供该文件
谢谢第一步是创建一个专用的Maven模块,其打包类型为
jar
,包含web.xml
。我们称之为com.mycompany:common
这样做有可能吗
<webXml>classpath:com/mycompany/common/web.xml</webXml>
<webXml>classpath:com/mycompany/common/web.xml</webXml>
您可以使用绝对路径,如“D:\dev”,尝试在build/resources下添加文件位置。。。谢谢,我可以使用依赖插件。注意:classpath:不起作用(至少对于war插件是这样),它无论如何都会在文件系统中找到它。