Reputation: 25467
I don't know why but maven-war-plugin
stopped moving my files to WEB-INF/config
. This is how I am using the plugin:
<profiles>
<profile>
<id>default-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/assembly/${package-mode}/config</directory>
<filtering>true</filtering>
<targetPath>WEB-INF/config</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
Question: What could I possible have done to break this again? It finally worked, now it doesn't anymore.
This is how I run my server:
mvn tomcat7:run-war -Denv=dev -Dpackage-mode=dev -DskipTests
The WAR file gets build and packed but those files from src/main/assembly/dev/config
are simply not there.
Upvotes: 0
Views: 2611
Reputation: 27862
Running the minimal pom below according to your question:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample</groupId>
<artifactId>web-sample</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<profiles>
<profile>
<id>default-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/assembly/${package-mode}/config</directory>
<filtering>true</filtering>
<targetPath>WEB-INF/config</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
And executing Maven as below:
mvn tomcat7:run-war -Dpackage-mode=dev
Files got copied corrently, as also specified by the build log:
[INFO] --- maven-war-plugin:2.6:war (default-war) @ web-sample ---
[INFO] Packaging webapp
[INFO] Assembling webapp [web-sample] in [C:\Development\workspace-mars\web-sample\target\web-sample]
[INFO] Processing war project
[INFO] Copying webapp webResources [C:\Development\workspace-mars\web-sample/src/main/assembly/dev/config] to [C:\Development\workspace-mars\web-sample\target\web-sample]
[INFO] Copying webapp resources [C:\Development\workspace-mars\web-sample\src\main\webapp]
[INFO] Webapp assembled in [106 msecs]
[INFO] Building war: C:\Development\workspace-mars\web-sample\target\web-sample.war
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.0:run-war (default-cli) < package @ web-sample <<<
Hence the error is somewhere else in your project or in your POM configuration.
I would suggest to run a
mvn clean
And retry. Also, to run a
mvn clean package
And check whether files are copied or not, regardless of the tomcat7 plugin execution.
Upvotes: 1