Maven-antrun 未定义蚂蚁目标 - 跳过



我正在尝试通过 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运行这个,问题是我在父模块和每个模块上都得到"未定义 ant 目标 - 跳过"。 我需要它仅在父级上运行,并认为<inherited>false</inherited>会有所帮助,但我没有。但为什么"没有定义蚂蚁目标"?

  <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

antrun:run只会考虑插件的配置,而不是特定执行的配置,因此您指定的执行将被忽略。作为运行单个 Maven 插件执行?状态,您可以为执行提供 default-cli ID 以选取它。

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

就像这样运行它:mvn antrun:run@copy

最新更新