Skip to content

Conversation

jhonnymertz
Copy link
Contributor

  • The last release included constructors to many mojos: 2.5.0...2.6.0, all of them having @Inject in it, apart from LicenseListMojo
  • This is potentially the cause for the issue I'm facing: class LicenseListMojo does not have a @Inject annotated constructor or a no-arg constructor.

Reproducing:

$ mvn org.codehaus.mojo:license-maven-plugin:2.6.0:license-list -Ddetail

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Software And Data Platforms SCA Build Tools                        [jar]
[INFO] SDP Global POM                                                     [pom]
[INFO] 
[INFO] ---------------< com.project.sdp.commons:sdp-commons-global >----------------
[INFO] Building SDP Global POM 4.0-SNAPSHOT                               [1/2]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- license:2.6.0:license-list (default-cli) @ sdp-commons-global ---
[WARNING] Error injecting: org.codehaus.mojo.license.LicenseListMojo
com.google.inject.ConfigurationException: Guice configuration errors:

1) [Guice/MissingConstructor]: No injectable constructor for type LicenseListMojo.

class LicenseListMojo does not have a @Inject annotated constructor or a no-arg constructor.

Requested by:                                                                                                                                                                                                                       
1  : LicenseListMojo.class(LicenseListMojo.java:48)                                                                                                                                                                                 
     while locating LicenseListMojo                                                                                                                                                                                                 

Learn more:                                                                                                                                                                                                                         
  https://github.com/google/guice/wiki/MISSING_CONSTRUCTOR                                                                                                                                                                          

1 error                                                                                                                                                                                                                             

======================                                                                                                                                                                                                              
Full classname legend:                                                                                                                                                                                                              
======================                                                                                                                                                                                                              
LicenseListMojo: "org.codehaus.mojo.license.LicenseListMojo"                                                                                                                                                                        
========================                                                                                                                                                                                                            
End of classname legend:                                                                                                                                                                                                            
========================                                                                                                                                                                                                            

    at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1127)
    at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1087)
    at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1139)
    at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:50)
    at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57)
    at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:67)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:109)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:124)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66)
    at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:62)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1101)
    at org.eclipse.sisu.inject.Guice4$2.get (Guice4.java:235)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:83)
    at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:53)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:265)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:257)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:491)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:114)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for SDP Global POM 4.0-SNAPSHOT:
[INFO]
[INFO] Software And Data Platforms SCA Build Tools ........ SKIPPED
[INFO] SDP Global POM ..................................... FAILURE [  2.865 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.207 s
[INFO] Finished at: 2025-07-21T11:18:43-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:2.6.0:license-list (default-cli) on project sdp-commons-global: Execution default-cli of goal org.codehaus.mojo:license-maven-plugin:2.6.0:license-list failed: Unable to load the mojo 'license-list' (or one of its required components) from the plugin 'org.codehaus.mojo:license-maven-plugin:2.6.0': com.google.inject.ProvisionException: Unable to provision, see the following errors:   
[ERROR]
[ERROR] 1) [Guice/MissingConstructor]: No injectable constructor for type LicenseListMojo.
[ERROR]
[ERROR] class LicenseListMojo does not have a @Inject annotated constructor or a no-arg constructor.
[ERROR]
[ERROR] Requested by:
[ERROR] 1  : LicenseListMojo.class(LicenseListMojo.java:48)
[ERROR]      while locating LicenseListMojo
[ERROR]      at ClassRealm[plugin>org.codehaus.mojo:license-maven-plugin:2.6.0, parent: ClassLoaders$AppClassLoader@5cb0d902]
[ERROR]       \_ installed by: WireModule -> PlexusBindingModule
[ERROR]      while locating Mojo annotated with @Named(value="org.codehaus.mojo:license-maven-plugin:2.6.0:license-list")
[ERROR]
[ERROR] Learn more:
[ERROR]   https://github.com/google/guice/wiki/MISSING_CONSTRUCTOR
[ERROR]
[ERROR] 1 error
[ERROR]
[ERROR] ======================
[ERROR] Full classname legend:
[ERROR] ======================
[ERROR] ClassLoaders$AppClassLoader: "jdk.internal.loader.ClassLoaders$AppClassLoader"
[ERROR] LicenseListMojo:             "org.codehaus.mojo.license.LicenseListMojo"
[ERROR] Mojo:                        "org.apache.maven.plugin.Mojo"
[ERROR] Named:                       "com.google.inject.name.Named"
[ERROR] PlexusBindingModule:         "org.eclipse.sisu.plexus.PlexusBindingModule"
[ERROR] WireModule:                  "org.eclipse.sisu.wire.WireModule"
[ERROR] ========================
[ERROR] End of classname legend:
[ERROR] ========================
[ERROR] 
[ERROR]       role: org.apache.maven.plugin.Mojo
[ERROR]   roleHint: org.codehaus.mojo:license-maven-plugin:2.6.0:license-list
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :sdp-commons-global

@slawekjaranowski
Copy link
Member

@jhonnymertz thanks, I added a simple integration test

@slawekjaranowski slawekjaranowski merged commit 8ea45d8 into mojohaus:master Jul 26, 2025
26 checks passed
@slawekjaranowski slawekjaranowski changed the title Adding missing @Inject to LicenseListMojo class Adding missing @Inject to LicenseListMojo class Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants