Question

i am trying to copy a file in my maven multi-module project via antrun plugin. the file is in root of parent project:

<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>                                                  

i run this via mvn antrun:run the problem is i get "No ant target defined - SKIPPED" on parent and on every module. i need it to run only on parent and thought <inherited>false</inherited> would help but i doesn't. But why "No ant target defined"?

Was it helpful?

Solution

  <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>

command : mvn antrun:run@ant-execute

OTHER TIPS

antrun:run will only consider the plugin's configuration, not that for a specific execution, so the execution you specify is ignored. As Run a single Maven plugin execution? states, you can give your execution an id of default-cli to have it picked up.

However, the execution you configure should already be taking effect during the regular build lifecycle.

just run it like this: mvn antrun:run@copy

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top