mojohaus / rpm-maven-plugin

http://www.mojohaus.org/rpm-maven-plugin/
Other
56 stars 48 forks source link

Regression: Cannot access method: org.codehaus.mojo.rpm.RPMMojo.setRpmbuildStage #84

Closed minfrin closed 6 years ago

minfrin commented 7 years ago

The following exception was introduced with the addition of the following PR:

https://github.com/mojohaus/rpm-maven-plugin/pull/66

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.2.0-SNAPSHOT:rpm (default-rpm) on project device-httpd2.4-core: Unable to parse configuration of mojo org.codehaus.mojo:rpm-maven-plugin:2.2.0-SNAPSHOT:rpm: Cannot access method: org.codehaus.mojo.rpm.RPMMojo.setRpmbuildStage( java.lang.String ) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:221) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357) Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of mojo org.codehaus.mojo:rpm-maven-plugin:2.2.0-SNAPSHOT:rpm: Cannot access method: org.codehaus.mojo.rpm.RPMMojo.setRpmbuildStage( java.lang.String ) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:597) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:529) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Cannot access method: org.codehaus.mojo.rpm.RPMMojo.setRpmbuildStage( java.lang.String ) at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.setValueUsingSetter(ComponentValueSetter.java:257) at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:302) at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:161) at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:567) ... 22 more Caused by: java.lang.IllegalAccessException: Class org.codehaus.plexus.component.configurator.converters.ComponentValueSetter can not access a member of class org.codehaus.mojo.rpm.AbstractRPMMojo with modifiers "public final" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:110) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:262) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:254) at java.lang.reflect.Method.invoke(Method.java:599) at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.setValueUsingSetter(ComponentValueSetter.java:253) ... 26 more

dantran commented 7 years ago

does it happen on 2.1.5? maven and java version?

minfrin commented 7 years ago

Does not happen in v2.1.5, occurred for the first time after I tried to patch v2.2.0-SNAPSHOT.

from CentOS7:

[minfrin@localhost rpm-maven-plugin-rpmsign]$ mvn --version Apache Maven 3.0.5 (Red Hat 3.0.5-17) Maven home: /usr/share/maven Java version: 1.7.0_141, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-514.26.2.el7.x86_64", arch: "amd64", family: "unix"

minfrin commented 7 years ago

https://github.com/mojohaus/rpm-maven-plugin/pull/85 fixes the issue for me.

dantran commented 7 years ago

Strange, just tested out my my production build with rpm-m-p-2.2.0-SNAPSHOT, dont see this issue I am using maven 3.5 and java 8 thou

minfrin commented 7 years ago

Looks like it breaks in some combinations of maven version, but not in others.

The underlying problem is that the original patch was inconsistent - all the other fields were marked "final", but the added fields were marked "final public". Fixing the declaration so that it was consistent with the existing code made the problem go away.

minfrin commented 7 years ago

Would it be possible to take another look at this one?

Our project depends on being able to be built on CentOS7, and this version is dead in the water until this issue is fixed :(

Where we're getting stuck is that in order to make a release, we need to depend on released plugins, including rpm-maven-plugin.