mavenmaven-antrun-plugin

antrun never copies jars


  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.8</version>
    <executions>
      <execution>
        <phase>deploy</phase>
        <configuration>
          <target>
            <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar" todir="${project.basedir}/../server/plug
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

After mvn install, I never see the jarfile copied from target/project.jar to ../server/plugins/project.jar.

Why isn't ant running?


Solution

  • Please see the Maven Lifecycle docs to see a list of the phases in Maven's default lifecycle. Note that deploy phase is after install.

    The above POM shows the plugin execution is bound to the deploy phase, but the command run was mvn install. So the execution doesn't run.

    You will either need to run mvn deploy, or change the phase to install or earlier phase, to see this command running.