trustin / os-maven-plugin

A Maven plugin that sets various useful properties detected from ${os.name} and ${os.arch} properties.
Apache License 2.0
296 stars 66 forks source link

Plugin is running twice and attempts to run on excluded module #35

Open bemonovoid opened 6 years ago

bemonovoid commented 6 years ago

Using plugin version: 1.4.1-Final. I have a multi module maven project that I am running with: mvn -pl "!excluded-module-name" clean package -T 4C -X

(The excluded-module-name uses the plugin as follows:

           <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.5.0</version>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier}</protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.0:exe:${os.detected.classifier}</pluginArtifact>
                </configuration>
                <executions>
                    ...
                </executions>
            </plugin>

)

Once the build started I can see from the logs:

14:49:39] : [Step 1/1] [INFO] os.detected.name: windows [14:49:39] : [Step 1/1] [INFO] os.detected.arch: x86_64 [14:49:39] : [Step 1/1] [INFO] os.detected.classifier: windows-x86_64 [14:49:39] : [Step 1/1] [INFO] ------------------------------------------------------------------------ [14:49:39] : [Step 1/1] [INFO] Reactor Build Order:

Here goes the list of all the modules to be built (it does not have the excluded-module-name that is expected)

Finally the build successfully completes:

[15:00:58] : [Step 1/1] [INFO] BUILD SUCCESS [15:00:58] : [Step 1/1] [INFO] ------------------------------------------------------------------------ [15:00:58] : [Step 1/1] [INFO] Total time: 11:20 min (Wall Clock) [15:00:58] : [Step 1/1] [INFO] Finished at: 2018-09-04T15:00:58+01:00 ....

After that it looks like the plugin attempts to run again with a failure:

[14:46:45] : [Step 1/1] [DEBUG] Extension realms for project my-artifact-name-SNAPSHOT: [ClassRealm[extension>kr.motd.maven:os-maven-plugin:1.4.1.Final, parent: sun.misc.Launcher$AppClassLoader@33909752]] [14:46:45] : [Step 1/1] [DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[project>[my-artifact-name]-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]] [14:46:46]W: [Step 1/1] [ERROR] [ERROR] Could not find the selected project in the reactor: excluded-module-name @ [14:46:46]W: [Step 1/1] [ERROR] Could not find the selected project in the reactor: excluded-module-name -> [Help 1] [14:46:46] : [Step 1/1] org.apache.maven.MavenExecutionException: Could not find the selected project in the reactor: excluded-module-name [14:46:46] : [Step 1/1] at org.apache.maven.graph.DefaultGraphBuilder.trimExcludedProjects (DefaultGraphBuilder.java:263) [14:46:46] : [Step 1/1] at org.apache.maven.graph.DefaultGraphBuilder.reactorDependencyGraph (DefaultGraphBuilder.java:125)

And the build that is in fact SUCCESSFUL fails.

If I run the build again just after this failure - it completes successfully without the plugin running twice. The error reproduces randomly

trustin commented 3 years ago

Sorry for a very late reply. Do you have a full stack trace of this failure? The given log does not show which part of this plugin is involved with the MavenExecutionException.