How to unpack an artifact and filter resources?

I find a way to copy any files to my web server using maven. I have a maven project that contains sets of html, js, properties and configuration files.

I would like to pack things and deploy them to the repository. After that, in another maven project, I would like to unzip the files from the artifact, filter the resources and copy them to the specified folders on the server.

What is the best way to do this?

maven-dependency-plugin can unpack the artifact, but I have not found how to use resource filtering in this case and how to specify multiple output directories.

+6
maven-2 maven-plugin filtering
source share
1 answer

I would create as many distributions as needed using the maven build plugin and use filtering during build . You can then deploy these assemblies to the repository and, indeed, use the maven dependency plugin to retrieve and unpack the assembly from this machine. For more information on assemblies, see Chapter 8. Maven Assemblies from the Sonatip Book.

Update: An alternative if you do not want to deploy β€œfiltered” assemblies would be to create the assembly from the target machine (still using profiles and filtering, as suggested). The created distribution will contain the correct contents in the correct folders (you can do this using assemblies), and you just need to unzip the archive for the last step.

+1
source share

All Articles