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