「Exec-Maven-Plugin」は実行されません
-
29-10-2019 - |
質問
次のプロファイルを正常に実行しています(「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クリーンインストール」を実行しても実行されません。なぜそうしないのかは私には不明です。
- - - - - - - アップデート - - - - - - -
一度提案が実行されたら、構成を実行内に配置しました。これは私が試したものであり、まだ実行されませんでした。
<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>
解決
「構成」は「実行中」にする必要があります。
<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>
他のヒント
プラグインは、別の、はるかに大きなプロファイルで定義されていました。私が本当にそうではなかったとき、私はそれを一般的なビルドに追加していると思いました。私はそれをプロフィールから移動し、うまくいきました。学んだ教訓。回答ありがとうございます。
所属していません StackOverflow