【问题标题】:how to execute multiple command prompt commands using maven in single pom.xml如何在单个 pom.xml 中使用 maven 执行多个命令提示符命令
【发布时间】:2013-07-09 16:36:45
【问题描述】:

我想使用单个 pom.xml 在 maven 中运行多个命令提示符命令。我该怎么做?

例如:我有 2 个命令要执行。我正在使用exec-maven-plugin 执行第一个命令。 下面是执行第一个命令的 pom.xml 部分:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <id>load files</id>
            <phase>install</phase>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
    <configuration>

        <executable>windchill</executable>
        <arguments>
            <argument>wt.load.LoadFileSet</argument>
            <argument>-file</argument>
            <argument>${basedir}/fileSet.xml</argument>
            <argument>-UNATTENDED</argument>
            <argument>-NOSERVERSTOP</argument>
            <argument>-u</argument>
            <argument>wcadmin</argument>
            <argument>-p</argument>
            <argument>wcadmin</argument>
        </arguments>

    </configuration>
</plugin>

为此构建成功。 是否可以像上面一样在同一个 pom.xml 中再执行一个命令?我无法做到这一点。所以有人请帮助如何在 pom.xml 中添加它

【问题讨论】:

    标签: maven exec-maven-plugin


    【解决方案1】:

    答案可以在FAQ中找到。 完整答案在这里:http://article.gmane.org/gmane.comp.java.maven-plugins.mojo.user/1307

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
            <execution>
                <id>id1</id>
                <phase>install</phase>
                <goals>
                    <goal>exec</goal>
                </goals>
                <configuration>
                    <executable>cmd1</executable>
                </configuration>
            </execution>
            <execution>
                <id>id2</id>
                <phase>install</phase>
                <goals>
                    <goal>exec</goal>
                </goals>
                <configuration>
                    <executable>cmd2</executable>
                </configuration>
            </execution>
        </executions>
    </plugin>
    

    【讨论】:

      【解决方案2】:

      然后您将执行 ID 指定为:

      mvn exec:exec@id2
      

      但是这种语法从 maven 3.3.1 开始是可能的

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-05-10
        • 1970-01-01
        • 2014-03-30
        • 1970-01-01
        • 1970-01-01
        • 2011-10-26
        相关资源
        最近更新 更多