首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >"exec-maven-plugin“不执行

"exec-maven-plugin“不执行
EN

Stack Overflow用户
提问于 2012-02-23 01:40:08
回答 2查看 3.8K关注 0票数 2

我成功执行了以下配置文件("mvn exec:exec -DrunMule"):

代码语言:javascript
复制
    <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构建时在特定阶段运行:

代码语言:javascript
复制
<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全新安装“时,这个新插件不会执行。我不清楚为什么它不会。

-更新

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

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-02-23 02:02:48

“‘configuration”应在“execution”下:

代码语言:javascript
复制
<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
EN

Stack Overflow用户

发布于 2012-02-24 06:08:39

该插件是在另一个更大的配置文件下定义的。我以为我是在将它添加到通用构建中,但实际上并非如此。我把它移出了档案,它起作用了。学到的教训。感谢您的回复。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9400057

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档