How do i hook a batch file to maven?

老子叫甜甜 提交于 2020-01-01 19:39:09

问题


i need to hook or attach a batch file to maven

so if lets say i type mvn package

and the there were no errors then a batch file i created would start running.

is there a way of doing something like that ?


回答1:


You can easily do that with the maven-exec-plugin and linking it with the package phase:

    <build>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2</version>
            <executions>
              <execution>
                <id>runbatchfile</id>
                <phase>package</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>c:\path\to\file.bat</executable>
            </configuration>
          </plugin>
        </plugins>

With this configuration : your batch file will be execute just after the default goal associated with the package phase.



来源:https://stackoverflow.com/questions/14872385/how-do-i-hook-a-batch-file-to-maven

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