Maven - copying resources from a client project to webapp

I have a project consisting of the end of a GWT client and the end of a Tomcat server. Everything is configured using maven. However, I want the client HTML and CSS files (which are in the resources folder) to be copied to the web projects directory of server projects. I am looking at the maven-dependency plugin but cannot make it work. I can't seem to find a way to specify the source and destination path. I would appreciate it if someone could point me in the right direction.

Thanks.

+4
source share
4 answers
<!-- Use the following to extract all files from the dependent jar or war (see type) : --> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>generate-sources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>com.group.id</groupId> <artifactId>artifact-id</artifactId> <version>1.0-SNAPSHOT</version> <type>jar</type> <overWrite>true</overWrite> <outputDirectory>target/exploded-artifact-id-jar</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <!-- then copy the neccessary files to the webapp directory --> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>copy-webapp-resources</id> <phase>generate-resources</phase> <configuration> <tasks> <copy todir="target/webapp" filtering="false"> <fileset dir="target/exploded-artifact-id-jar/path-to-files"/> </copy> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> 
+2
source

You need to create the public folder at the same level as the module configuration file <module_name>.gwt.xml . I.e:

 +src/main/resources |-<module_name>.gwt.xml |-+public |-<static resources> 

Thus, after compiling gwt, all resources will go to src/main/webapp/<module_name>/ . This folder is the one that maven (through the plugin), or you (manually) will use to create the final webapp.

Hope this helps.
Relations

0
source
0
source

In pom.xml you can specify the resources that you want to use. For instance:

 <build> <!-- Resources to be bundeled with the final WAR --> <resources> <resource> <directory>config</directory> </resource> <resource> <directory>src/main/java</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources> 
0
source

All Articles