2

正常に実行している次のプロファイルがあります( "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>

「mvncleaninstall」を実行すると、この新しいプラグインは実行されません。なぜそうならないのか私にはわかりません。

- - - - - - - アップデート - - - - - - -

かつての提案は、構成を実行内に配置することでした。これは私が試したものですが、それでも実行されませんでした。

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

2 に答える 2

2

「構成」は「実行」の下にある必要があります。

<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>
于 2012-02-22T18:02:47.857 に答える
1

プラグインは、別のはるかに大きなプロファイルで定義されていました。私は本当にそうではなかったときに、私はそれを一般的なビルドに追加していると思っていました。プロファイルから移動したところ、機能しました。学んだ教訓。回答ありがとうございます。

于 2012-02-23T22:08:39.363 に答える