harrisric opened a new issue, #369:
URL: https://github.com/apache/maven-enforcer/issues/369

   ### Affected version
   
   3.5.0
   
   ### Bug description
   
   According to the existing 
[documentation](https://maven.apache.org/enforcer/maven-enforcer-plugin/plugin-info.html)
 the enforcer-plugin should be usable at 3.6.3, however I have found that when 
using custom rules configured via `@Inject` you need to use Maven 3.9.6+, 
certainly if using Java 17.
   There isn't any specific additional documentation that I can see noting this 
restriction for custom rules.
   
   The stack trace seen is e.g.
   
   ```
   Caused by: java.lang.NoSuchMethodException: 
FullyQualifiedClassNameOfRule.<init>()
       at java.lang.Class.getConstructor0 (Class.java:3585)
       at java.lang.Class.newInstance (Class.java:626)
       at 
org.apache.maven.plugins.enforcer.internal.EnforcerRuleManager.createRuleDesc 
(EnforcerRuleManager.java:160)
       at 
org.apache.maven.plugins.enforcer.internal.EnforcerRuleManager.createRules 
(EnforcerRuleManager.java:110)
       at org.apache.maven.plugins.enforcer.EnforceMojo.execute 
(EnforceMojo.java:213)
       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
(DefaultBuildPluginManager.java:137)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 
(MojoExecutor.java:370)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute 
(MojoExecutor.java:351)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:215)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:171)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:163)
       at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:117)
       at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:81)
       at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
 (SingleThreadedBuilder.java:56)
       at org.apache.maven.lifecycle.internal.LifecycleStarter.execute 
(LifecycleStarter.java:128)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
       at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
       at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:77)
       at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke (Method.java:569)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
(Launcher.java:283)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launch 
(Launcher.java:226)
       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
(Launcher.java:407)
       at org.codehaus.plexus.classworlds.launcher.Launcher.main 
(Launcher.java:348)
   
   ```
   
   I think that the problem is related to the core maven fix 
https://issues.apache.org/jira/browse/MNG-7913


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to