Monday, December 23, 2019

How to copy folder with Maven

Example below shows how to copy a directory during Maven build. 


<build>

    <plugins>

        <!-- copy directory -->        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <!-- here the phase you need -->                    <phase>install</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${basedir}/path/to/target/directory</outputDirectory>
                        <resources>
                            <resource>
                                <directory>src/path/to/source/directory</directory>
                                <filtering>true</filtering>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>

</build>


Build!!

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...