maven可以运行命令行指令吗?

maven可以运行命令行指令吗?

问题描述:

我们可以将一些本地操作系统命令绑定到maven的目标和/或阶段吗?maven可以运行命令行指令吗?

其实这些情况下有Exec Maven Plugin

+0

它的答案被选中,因为它解决了我的问题。但有问题的话,我会采取任何指令,而不仅仅是java任务。 – Max 2009-07-02 07:28:27

查看exec-maven-plugin的详细信息

+2

我猜他可以从我提供的页面找到那个链接 – jitter 2009-07-01 21:35:20

非原生。

但是,通过使用AntRun plugin,可以指定在构建期间执行OS命令的Ant任务(使用Exec)。

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