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

der*_*itz 11 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>                                                  
Run Code Online (Sandbox Code Playgroud)

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

小智 14

  <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>
Run Code Online (Sandbox Code Playgroud)

命令:mvn antrun:run @ ant-execute


Joe*_*Joe 6

antrun:run只会考虑插件的配置,而不是特定执行的配置,因此会忽略您指定的执行.作为运行单个的Maven插件执行?陈述,你可以给你的执行一个id default-cli来让它被拿起来.

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


Jes*_*ong 6

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

  • 您能否在答案中添加更多解释? (4认同)