How to unpack artifact and filter resources?
I am finding a way how to copy any files to my web server using maven. I have a maven project which contains a sets of html, js, properties and configuration files.
开发者_开发知识库I would like pack my stuff and deploy to repository. After that in another maven project I would like to unpack files from artifact, filtering resources and copy to the specifying folders on the server.
What is a best way to do it?
maven-dependency-plugin can unpack artifact but I didn't find how to use resource filtering in this case and how to specify several output directories.
I would create as many distributions as required using the maven assembly plugin and use filtering at assembly time. You could then deploy these assemblies to a repository and, indeed, use the maven dependency plugin to retrieve and unpack an assembly from a given machine. More on assemblies in the Chapter 8. Maven Assemblies of Sonatype's book.
Update: An alternative if you don't want to deploy "filtered" assemblies would be to create the assembly from the targeted machine (still using profiles and filtering as suggested). The created distribution would contain the right content in the right folders (you can do that with assemblies) and you would just have to decompress the archive for the last step.
精彩评论