Can maven run commandline instructions?

佐手、 提交于 2019-12-01 13:50:53

问题


Can we bind some native OS commands to the maven goals and/or phases?


回答1:


Actually there is the Exec Maven Plugin for these cases.




回答2:


See exec-maven-plugin for details




回答3:


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>


来源:https://stackoverflow.com/questions/1069443/can-maven-run-commandline-instructions

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