7
我刚刚将一个ant项目翻译成maven,不过由于maven并没有真正处理部署,我在构建中引入了一些antrun。但是,当我尝试执行它时,插件会跳过我的任务。例如,当我运行mvn clean antrun时:运行我得到以下消息:没有定义ant目标 - 跳过。在第二阶段中,我尝试重写部署阶段以执行实际部署,而不是上载到存储库。如何将maven antrun插件绑定到清理阶段
请在下面找到我的pom.xml中的提取物(类型:POM):
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>clean</id>
<configuration>
<task>
<echo>Cleaning deployed website</echo>
</task>
<tasks>
<delete dir="${deployRoot}/mydir/${env}"/>
</tasks>
</configuration>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>deployment</id>
<configuration>
<task>
<echo>Deploying website</echo>
</task>
<tasks>
<echo>Copying website artifact to deployment </echo>
<mkdir dir="${deployRoot}/mydir/${env}" />
<unzip
src="${project.basedir}/target/${env}.${project.version}.zip"
dest="${deployRoot}/mydir/${env}" />
<chmod perm="ugo+rx">
<fileset dir="${deployRoot}/mydir/${env}/web-exploded/bin">
<include name="**/*.sh" />
<include name="**/*.bat" />
</fileset>
</chmod>
</tasks>
</configuration>
<phase>deploy</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>