Maven-antrun没有定义蚂蚁目标 - 跳过

时间:2013-09-25 09:43:16

标签: maven maven-antrun-plugin

我正在尝试通过antrun插件复制我的maven多模块项目中的文件。该文件位于父项目的根目录中:

<plugin>                                                           
<groupId>org.apache.maven.plugins</groupId>                    
<artifactId>maven-antrun-plugin</artifactId>                   
<version>1.7</version>                                         
<inherited>false</inherited>                                   
<executions>                                                   
    <execution>                                                
        <inherited>false</inherited>                           
        <id>copy</id>                                          
        <goals>                                                
            <goal>run</goal>                                   
        </goals>                                               
        <configuration>                                        
            <target name="copy and rename file">               
                <copy file="${basedir}/portal-ext.properties" tofile="${liferay.auto.deploy.dir}/../portal-ext.properties" />

            </target>                                          
        </configuration>                                       
    </execution>                                               
</executions>                                                  

我通过mvn antrun:run运行此问题是我在父级和每个模块上得到“没有定义蚂蚁目标 - 跳过”。我需要它只在父母身上运行而且<inherited>false</inherited>会有所帮助,但我没有。但为什么“没有定义蚂蚁目标”?

3 个答案:

答案 0 :(得分:13)

  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
      <execution>
        <id>ant-execute</id>
        <configuration>
          <target>
          <echo message="plugin classpath:  " />
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

命令:mvn antrun:run @ ant-execute

答案 1 :(得分:6)

antrun:run只会考虑插件的配置,而不是特定执行的配置,因此会忽略您指定的执行。正如Run a single Maven plugin execution?所述,您可以为执行提供default-cli的ID,以便将其取消。

但是,您配置的执行应该已经在常规构建生命周期中生效。

答案 2 :(得分:3)

按照以下方式运行:mvn antrun:run@copy