Open Captain-P-Goldfish opened 3 years ago
@Captain-P-Goldfish : Thanks a lot for reporting this. Do you have some quick reproducer project which we can try out to reproduce ?
Thanks a lot for sharing the reproducer project. I can reproduce this issue.
On debugging, I'm realizing that it's maven issue rather than being related to plugin. I made a simple project with exec-maven-plugin
just like yours(https://github.com/r0haaaan/exec-maven-plugin-multiple-profile-execution) and I was able to see same issue.
I had two profiles like this:
<profiles>
<profile>
<id>hello</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>hello</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>maven</executable>
<mainClass>maven.testing.HelloPrint</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bye</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>bye</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>maven</executable>
<mainClass>maven.testing.ByePrint</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
When I run mvn clean install -Phello,bye
I can see only second profile configuration being picked up:
exec-maven-plugin-multiple-profile-execution : $ mvn clean install -Phello,bye
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< org.example:exec-maven-plugin-testing >----------------
[INFO] Building exec-maven-plugin-testing 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ exec-maven-plugin-testing ---
[INFO] Deleting /home/rohaan/work/repos/exec-maven-plugin-multiple-profile-execution/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ exec-maven-plugin-testing ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ exec-maven-plugin-testing ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /home/rohaan/work/repos/exec-maven-plugin-multiple-profile-execution/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ exec-maven-plugin-testing ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/rohaan/work/repos/exec-maven-plugin-multiple-profile-execution/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ exec-maven-plugin-testing ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ exec-maven-plugin-testing ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ exec-maven-plugin-testing ---
[INFO] Building jar: /home/rohaan/work/repos/exec-maven-plugin-multiple-profile-execution/target/exec-maven-plugin-testing-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (hello) @ exec-maven-plugin-testing ---
Bye
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (bye) @ exec-maven-plugin-testing ---
Bye
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ exec-maven-plugin-testing ---
[INFO] Installing /home/rohaan/work/repos/exec-maven-plugin-multiple-profile-execution/target/exec-maven-plugin-testing-1.0-SNAPSHOT.jar to /home/rohaan/.m2/repository/org/example/exec-maven-plugin-testing/1.0-SNAPSHOT/exec-maven-plugin-testing-1.0-SNAPSHOT.jar
[INFO] Installing /home/rohaan/work/repos/exec-maven-plugin-multiple-profile-execution/pom.xml to /home/rohaan/.m2/repository/org/example/exec-maven-plugin-testing/1.0-SNAPSHOT/exec-maven-plugin-testing-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.515 s
[INFO] Finished at: 2021-03-13T15:15:07+05:30
[INFO] ------------------------------------------------------------------------
oh great... I just tried to put the configuration into the execution-section and it works like this. This will at least do for me. But did not expect this. It's the first time I am having problems with differnet plugin configurations over different profiles...
Hi we got the following describes setup. We are using two profiles. One to push into our own registry and one to push into the registry of our customer. If both profiles are executed with
mvn clean package -P docker-image-to-customer-registry,docker-image-to-private-registry
I would expect to have 2 images in my local machine registry:The log shows clearly that both profiles are executed successfully but both profiles are building an image with the same name:
So it seems clear to me that the last setup name does always win.