Can maven run commandline instructions?

℡╲_俬逩灬. 提交于 2019-12-01 15:46:28
jitter

Actually there is the Exec Maven Plugin for these cases.

See exec-maven-plugin for details

Romain Linsolas

Not natively.

However, by using the AntRun plugin, you can specify an Ant task (using Exec) that execute a OS command during the build.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase> <!-- a lifecycle phase --> </phase>
            <configuration>
              <tasks>

                <!--
                  Place any Ant task here. You can add anything
                  you can add between <target> and </target> in a
                  build.xml.
                -->

              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!