CI_CD/maven
[maven] pom.xml 빌드시 파일이동 및 삭제 방법
홍또~
2021. 1. 4. 23:10
로컬 빌드 에서는 크게 필요가 없을 수 있으나,
서버에 올리게 될 때는 properties 파일이나 기타 license,library 때문에 파일명을 변경하거나 이동해야할 경우가 있다.
이 때 ant관련 추가 plugin을 작성하여 해결 할 수 있다.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>edit properties!</echo>
<copy file="${basedir}/${property.route}/aa_dev.xml" tofile="${basedir}/${property.route}/aa.xml" overwrite="true"/>
<delete file="${basedir}/${property.route}/aa_dev.xml"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
1. 파일 복사
코드의 copy file에서 tofile로 복사한다. 이때 overwrite 옵션이 true이면 덮어쓰게 된다.
2. 파일 삭제
delete file로 삭제한다