본문 바로가기
  • 아하하
미분류

[maven] Move a text file into target folder when compiling a Maven project

by 쥬쥬파파 2014. 9. 16.

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</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/output</outputDirectory>
               <resources>         
                    <resource>
                        <directory>input</directory>
                        <filtering>true</filtering>
                    </resource>
               </resources>             
            </configuration>           
        </execution>
     </executions>
</plugin>

 

 

or

 

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.1</version>
    <executions>
        <execution>
            <phase>test</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <tasks>
                    <echo>Using env.test.properties</echo>
                    <copy file="textfile.txt" tofile="${basedir}/target/textfile.txt"/>
                    </tasks>
                </configuration>
            </execution>
        </executions>
    </plugin>