项目中,maven打正式环境的war包时,需要将config.js替换掉。用tasks标签,先将config.js删除,然后将config-online.js文件名改成config.js
<profile>
<id>online</id><properties>
<profiles.active>online</profiles.active>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- <delete file="./src/main/webapp/js/config.js" /> -->
<move file="${project.build.directory}/${project.build.finalName}/js/config-online.js" tofile="${project.build.directory}/${project.build.finalName}/js/config.js"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>