jgitver-maven-plugin
jgitver-maven-plugin copied to clipboard
flatten plugin cannot be loaded due to jgitver
Before submitting an issue I have first:
- [x] searched for similar already existing issue
- [x] read the documentation and wiki
Issue
flatten plugin cannot be loaded because jgitver has no bound implementation
1.7.0:
- [x] maven command line: 3.5.0, 3.6.3
Parent POM has flatten-plugin 1.2.5 (I try to use the latest version to get around the classifier issue https://github.com/mojohaus/flatten-maven-plugin/issues/132) configured as follows
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.5</version>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>pom.xml</flattenedPomFilename>
</configuration>
<executions>
<execution>
<id>flatten-poms</id>
<phase>package</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
The following happens when children POM is flattened
[ERROR] Failed to execute goal org.codehaus.mojo:flatten-maven-plugin:1.2.5:flatten (flatten-poms) on project giad-war: Execution flatten-poms of goal org.codehaus.mojo:flatten-maven-plugin:1.2.5:flatten failed: Unable to load the mojo 'flatten' (or one of its required components) from the plugin 'org.codehaus.mojo:flatten-maven-plugin:1.2.5': com.google.inject.ProvisionException: Unable to provision, see the following errors:
[ERROR]
[ERROR] 1) No implementation for fr.brouillard.oss.jgitver.JGitverConfiguration was bound.
[ERROR] while locating fr.brouillard.oss.jgitver.JGitverModelProcessor
[ERROR] at ClassRealm[plugin>fr.brouillard.oss:jgitver-maven-plugin:1.7.0, parent: sun.misc.Launcher$AppClassLoader@7852e922] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] at ClassRealm[plugin>fr.brouillard.oss:jgitver-maven-plugin:1.7.0, parent: sun.misc.Launcher$AppClassLoader@7852e922] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] while locating org.apache.maven.model.building.ModelProcessor
[ERROR] at org.eclipse.sisu.wire.LocatorWiring
[ERROR] while locating org.apache.maven.model.building.ModelProcessor
[ERROR] for field at org.codehaus.mojo.flatten.ModelBuilderThreadSafetyWorkaround.modelProcessor(Unknown Source)
[ERROR] while locating org.codehaus.mojo.flatten.ModelBuilderThreadSafetyWorkaround
[ERROR] for field at org.codehaus.mojo.flatten.FlattenMojo.modelBuilderThreadSafetyWorkaround(Unknown Source)
[ERROR] while locating org.codehaus.mojo.flatten.FlattenMojo
[ERROR] at ClassRealm[plugin>org.codehaus.mojo:flatten-maven-plugin:1.2.5, parent: sun.misc.Launcher$AppClassLoader@7852e922] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=org.codehaus.mojo:flatten-maven-plugin:1.2.5:flatten)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: org.codehaus.mojo:flatten-maven-plugin:1.2.5:flatten
Hum it's new to me, moreover adb34bbcac212bf110a5665a0020b3572fc197be was there to correct that.
also I did not checked with latest flatten versions.
jgitver automatic integration/usage with flatten was done with 1.0.1 see JGitverModelProcessor.java#L187
I think the sisu index is missing...
I set the phase for flatten to package since validate seemed early, but it is not essential; flatten 1.2.2 works fine (except for dependencies with classifiers).
I am in the process of reviewing the extension/plugin and how it works in regards of some maven internals for injection (see my exchanges on maven dev mailing list) ; i'll review that after the cleanup.
I believe the discussion is interesting and deserves to be referred here. Is there a solution for the classloading problem?
Hi, I continued the exploration of what is discussed in the mailing list. I refactored jgitver to use the injection mechanism and separation between extension and plugin but I am facing another classloading issue when inside the reactor. I am currently busy simplifying the problem to show to the maven core developpers. It's a bit long I know but then the codebase will be in a better shape for future evolutions/modifications.
We regularly encounter this problem on our projects - many small microservices all using jgitver... and the flatten plugin. Any news or progress on this issue ?
Unfortunately the refactored version is still in branch and was never finished & pushed due to lack of time. So no there is no progress on this item.
Thank you McFoggy for that quick reply and for that incredibly useful plugin you have created.
For the time being, for those that are encountering the aforementioned problem, the workaround is to downgrade the maven-flatten-plugin to version 1.2.3 this is the most recent version that works flawlessly with JGitver.
Encountered the same problem, AGAIN! But found another way to make it work with the latest flatten plugin:
<pluginManagement>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.7</version>
<dependencies>
<dependency>
<groupId>fr.brouillard.oss</groupId>
<artifactId>jgitver-maven-plugin</artifactId>
<version>1.9.0</version>
</dependency>
</dependencies>
</plugin>
</pluginManagement>