I'm rewriting legacy Spring project build script from Ant to Maven. The project has several GWT modules, each compiled to JAR. The current project structure consists of several Maven modules, which is more or less like this:
mainProject
|- AnalyzerGWT <-- this module uses GWT
|- analyzer <-- this doesn't
|- someOtherModule
|- p4you-spring <-- this module has resources and builds WAR
Each module, which uses GWT, has following code in its pom.xml (module is called AnalyzerGWT):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
<compileSourcesArtifacts>
<artifact>com.pamm:portal-common</artifact>
<artifact>com.pamm:analyzer</artifact>
</compileSourcesArtifacts>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
It compiles successfully and result GWT resources are saved into AnalyzerGWT/target/AnalyzerGWT-1.0/com.pamm.analyzer.gwt.Analyzer/, however the content of this directory is not included to result JAR file.
Is there an elegant way to copy the content of this directory into JAR's root path?
I managed to solve the problem by adding:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>
${project.build.directory}/AnalyzerGWT-1.0/com.pamm.analyzer.gwt.Analyzer/
</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
to the <plugins>
section in pom.xml.