«Exec-maven-plugin» ne s’exécute pas
-
29-10-2019 - |
Question
J'ai le profil suivant que j'exécute avec succès ("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>
J'essaie de le convertir pour qu'il s'exécute à un stade spécifique lors de l'exécution d'une compilation maven dans le même pom.xml:
<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>
Ce nouveau plugin ne s'exécute pas lorsque j'effectue une "installation propre mvn".Je ne vois pas pourquoi ce ne serait pas le cas.
-------------- mise à jour --------------
Une fois, la suggestion était de mettre la configuration dans l'exécution.C'est ce que j'ai essayé et cela ne s'est toujours pas exécuté.
<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>
La solution
'configuration' doit être sous 'exécution':
<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>
Autres conseils
Le plugin a été défini sous un autre profil beaucoup plus large.Je pensais l'ajouter à la version générale alors que je ne l'étais vraiment pas.Je l'ai déplacé hors du profil et cela a fonctionné.Leçon apprise.Merci pour les réponses.