Maven Resource Plugin Copying Files

Currently, I have some Maven projects which, when installing the project, I need to copy all the files from the conf folder to the target folder.

|-Project |--src |--conf <--FROM HERE --> |--lib |--target <--TO HERE--> 

I tried to do this in pom.xml to no avail. What am I doing wrong? My plugin part pom.xml is below:

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <phase>install</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target</outputDirectory> <resources> <resource> <directory>${basedir}/conf</directory> <includes> <include>*</include> </includes> </resource> </resources> </configuration> </execution> </executions> 

+6
source share
1 answer

Your problem is that you are copying resources in the install phase. At this point, your target archive is already built and copied to your local repository. See the Maven Life Cycle . You will want to do this in the process-resources phase.

+5
source

Source: https://habr.com/ru/post/959473/


All Articles