Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatten plugin cannot be loaded due to jgitver #149

Open
3 tasks done
twogee opened this issue Feb 4, 2021 · 11 comments
Open
3 tasks done

flatten plugin cannot be loaded due to jgitver #149

twogee opened this issue Feb 4, 2021 · 11 comments
Assignees
Labels

Comments

@twogee
Copy link

twogee commented Feb 4, 2021

Before submitting an issue I have first:

  • searched for similar already existing issue
  • read the documentation and wiki

Issue

flatten plugin cannot be loaded because jgitver has no bound implementation

1.7.0:

  • 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 mojohaus/flatten-maven-plugin#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

@McFoggy
Copy link
Contributor

McFoggy commented Feb 4, 2021

Hum it's new to me, moreover adb34bb was there to correct that.

@McFoggy McFoggy added the bug label Feb 4, 2021
@McFoggy
Copy link
Contributor

McFoggy commented Feb 4, 2021

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

@McFoggy
Copy link
Contributor

McFoggy commented Feb 4, 2021

I think the sisu index is missing...

@McFoggy McFoggy self-assigned this Feb 4, 2021
@twogee twogee changed the title flatten plugin cannot be loaded due to jgiver flatten plugin cannot be loaded due to jgitver Feb 4, 2021
@twogee
Copy link
Author

twogee commented Feb 4, 2021

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).

@McFoggy
Copy link
Contributor

McFoggy commented Feb 5, 2021

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.

@twogee
Copy link
Author

twogee commented Feb 21, 2021

I believe the discussion is interesting and deserves to be referred here. Is there a solution for the classloading problem?

@McFoggy
Copy link
Contributor

McFoggy commented Feb 21, 2021

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.

@zartc
Copy link

zartc commented Jun 9, 2022

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 ?

@McFoggy
Copy link
Contributor

McFoggy commented Jun 9, 2022

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.

@zartc
Copy link

zartc commented Jun 9, 2022

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.

@zartc
Copy link

zartc commented Aug 15, 2022

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants