现在这是彻头彻尾的奇怪:我有很多文件夹/文件要复制到我的WAR中,这里是POM的相关部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource><directory>../common-web-content/src/main/resources</directory></resource>
<resource><directory>../pqm-web-content/src/main/resources</directory><filtering>true</filtering></resource>
<resource><directory>../common-presentation/src/main/webapp</directory></resource>
<resource>
<directory>${project.basedir}/src/main/webapp/WEB-INF</directory>
<includes><include>web.xml</include></includes>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
路径都是正确的并经过双重检查。但是, 第二个资源文件夹未被复制 - 在这种情况下是pqm-web-content,但即使我更改了序列,它也总是第二个丢失的。但是没有错误消息:
[INFO] Processing war project
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war\../common-web-content/src/main/resources] to[D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT]
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war\../pqm-web-content/src/main/resources] to[D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT]
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war\../common-presentation/src/main/webapp] to[D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT]
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war/src/main/webapp/WEB-INF] to [D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT]
[INFO] Webapp assembled in[7891 msecs]
答案 0 :(得分:2)
显然,这是Maven的错误或Maven 3.0.3与WAR插件之间的不兼容。切换到Maven 2.2.1后,它可以正常工作。
答案 1 :(得分:1)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource><directory>../common-web-content/src/main/resources</directory></resource>
<!-- this next line is repeated because of a problem I am having with the maven-war-plugin -->
<resource><directory>../pqm-web-content/src/main/resources</directory><filtering>true</filtering></resource>
<resource><directory>../pqm-web-content/src/main/resources</directory><filtering>true</filtering></resource>
<resource><directory>../common-presentation/src/main/webapp</directory></resource>
<resource>
<directory>${project.basedir}/src/main/webapp/WEB-INF</directory>
<includes><include>web.xml</include></includes>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
答案 2 :(得分:0)
我从maven-war-plugin version 2.6
遇到与两个连续目录类似的问题,第一个内容不会被复制到最终版本。
问题是我在单个<directory>
标记中有两个<resource>
个标记。单<resource>
个<directory>
标记工作正常。