Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 289
eugenn Avatar asked Mar 04 '10 13:03

eugenn


People also ask

What is unpack in Maven?

org.apache.maven.plugins:maven-dependency-plugin:3.3.0:unpack. Description: Goal that retrieves a list of artifacts from the repository and unpacks them in a defined location.

What does Maven dependency plugin do?

The dependency plugin provides the capability to manipulate artifacts. It can copy and/or unpack artifacts from local or remote repositories to a specified location.

What is Maven Assembly plugin?

The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive that also contains dependencies, modules, site documentation, and other files. Your project can easily build distribution "assemblies" using one of the prefabricated assembly descriptors.


1 Answers

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.

like image 98
Pascal Thivent Avatar answered Oct 11 '22 14:10

Pascal Thivent