I want to migrate about 15 Ant projects to Maven.
Current build with Ant:
project-1
project-2 (needs project-3 as dependency)
project-3
project-webresources (contains web resources needed by ALL other projects)
project-WAR (empty target project)
(project-1, project-2, project-3 contain additional web resources)
Now, different WARs have to be built:
For Deployment 1 (contains project-1 and project-webresources):
Java sources from project-1 are compiled and copied to project-WAR/WEB-INF/classes
Web resources from project-webresources and project-1 are copied to project-WAR/
For Deployment 2 (contains project-1, project-2, project-3 and project-webresources):
Java sources from project-1, project-2, project-3 are compiled an copied to project-WAR/WEB-INF/classes
Web resources from project-webresources, project-1, project-2 and project-3 are copied to project-WAR/
My plan to realize it with Maven:
The projects become modules and for every deployment I create a project which holds the needed modules and one target WAR artifact. For the project-webresources I use maven overlays.
Build-deployment-1:
(mvn install here to build the deployment-1 Web archive)
<packaging>pom</packaging>
<modules>
<module>project-1</module>
<module>project-webresources</module>
<module>WAR-deployment-1</module>
</modules>
WAR-deployment-1:
<packaging>jar</packaging>
<dependency>
<groupId>com.groupId</groupId>
<artifactId>project-webresources</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.groupId</groupId>
<artifactId>artifact-1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
For the second WAR there will be projects like Build-deployment-2 and WAR-deployment-2 and so on which use other module combinations.
My problem:
What is the best way to copy all web resources from project-1 to WAR-deployment-1? If I use maven-resources-plugin in project-1 to copy resources to WAR-deployment-1 the target directory is hard coded to WAR-deployment-1. What if project-1 is part of build-deployment-2 and files have to be copied to WAR-deployment-2?! Can I use build properties for this? Or is the assembly plugin a solution?