我如何挂钩一个批处理文件到Maven? [英] How do i hook a batch file to maven?

查看:176
本文介绍了我如何挂钩一个批处理文件到Maven?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要连接或附加一个批处理文件到Maven

i need to hook or attach a batch file to maven

所以,如果让我们说我型
   MVN包

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 ?

推荐答案

您可以轻松做到这一点与 的maven-EXEC-插件 并与包相联的:

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.

这篇关于我如何挂钩一个批处理文件到Maven?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆