Is it possible to copy folders from my project to a certain location during some Maven phase? Does anybody know how?
In a project that follows the mavenSW conventions, resources such as *. properties files can be placed in a src/main/resources directory. The files/folders in this directory will be copied to the root level of the jarW (or other similar package) that is generated for the project.
basedir : The directory that the current project resides in. This means this points to where your Maven projects resides on your system. It corresponds to the location of the pom. xml file.
The Maven Clean Plugin, as the name implies, attempts to clean the files and directories generated by Maven during its build. While there are plugins that generate additional files, the Clean Plugin assumes that these files are generated inside the target directory.
For the information on how to work with Maven projects, refer to Maven projects. For the auto-import settings, refer to Build Tools. Select this checkbox to specify the location of your project's files after the import. For example, when you import a project and want to keep the iml file and .
The Maven way of doing this would be using the copy-resources
goal in maven-resources-plugin
From http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
<project> ... <build> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.7</version> <executions> <execution> <id>copy-resources</id> <!-- here the phase you need --> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/extra-resources</outputDirectory> <resources> <resource> <directory>src/non-packaged-resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> ... </build> ... </project>
Take a look at the maven-antrun plugin. You can copy a file in any maven phase like this:
<plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.4</version> <executions> <execution> <id>copy</id> <phase>compile</phase> <configuration> <tasks> <copy file="myFileSource" tofile="MyFileDest"/> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With