【问题标题】:"exec-maven-plugin" does not execute“exec-maven-plugin”不执行
【发布时间】:2012-03-13 02:11:39
【问题描述】:

我有以下我正在成功执行的配置文件(“mvn exec:exec -DrunMule”):

    <profile>
        <id>runMule</id>
        <activation>
            <property>
                <name>runMule</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.2.1</version>
                    <configuration>
                        <executable>java</executable>
                        <arguments>
                            <argument>-classpath</argument>
                            <!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
                            <classpath/>
                            <argument>org.mule.MuleServer</argument>
                            <argument>-config</argument>
                            <argument>mule-config.xml</argument>
                        </arguments>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

在同一个 pom.xml 中执行 maven 构建时,我正在尝试将其转换为在特定阶段运行:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>java</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <mainClass>org.mule.MuleServer</mainClass>
        <arguments>
            <argument>-classpath</argument>
            <classpath/>
            <argument>-config</argument>
            <argument>mule-config.xml</argument>
        </arguments>
    </configuration>

当我执行“mvn clean install”时,这个新插件不会执行。我不清楚为什么它不会。

------------- 更新 --------------

曾经的建议是将配置放入执行中。这是我尝试过的,但仍然没有执行。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>java</executable>
                <arguments>
                    <argument>-classpath</argument>
                    <classpath/>
                    <argument>org.mule.MuleServer</argument>
                    <argument>-config</argument>
                    <argument>mule-config.xml</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

【问题讨论】:

  • 如果你运行mvn validate会发生什么?

标签: maven mule exec-maven-plugin


【解决方案1】:

“配置”应该在“执行”下:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
           <executable>echo</executable>
           <arguments>
              <argument>"test"</argument>
           </arguments>
        </configuration>
      </execution>
    </executions>
  </plugin>

【讨论】:

  • 那行不通。它仍然没有运行。我更新了问题以包含尝试。
【解决方案2】:

插件是在另一个更大的配置文件下定义的。我以为我正在将它添加到一般构建中,而实际上我并没有。我把它从个人资料中移出,它起作用了。学过的知识。感谢您的回复。

【讨论】:

    猜你喜欢
    • 2014-04-23
    • 2011-01-12
    • 1970-01-01
    • 2012-10-25
    • 2012-11-13
    • 1970-01-01
    • 2017-05-06
    • 2014-07-04
    • 2018-03-20
    相关资源
    最近更新 更多