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

broken maven-enforcer configuration #14376

Open
Bananeweizen opened this issue Jan 28, 2024 · 12 comments · Fixed by #14397 · May be fixed by #14642
Open

broken maven-enforcer configuration #14376

Bananeweizen opened this issue Jan 28, 2024 · 12 comments · Fixed by #14397 · May be fixed by #14642

Comments

@Bananeweizen
Copy link
Contributor

Bananeweizen commented Jan 28, 2024

The POM has 2 different maven-enforcer configurations, because the parent (sonatype-oss) and the checkstyle pom.xml use different execution ids.

This is from Sonatype parent pom.xml:

                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
                                    <message>Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums respectively.</message>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>

From checkstyle pom.xml:

checkstyle/pom.xml

Lines 1352 to 1356 in 50683f1

<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>enforce-versions</id>

Note the 2 different ids. This is problematic for instance when executing the versions plugin:

mvn versions:display-plugin-updates

which wrongly complains about no maven version being defined:

[ERROR] Project does not define required minimum version of Maven.
[ERROR] Update the pom.xml to contain maven-enforcer-plugin to
[ERROR] force the Maven version which is needed to build this project.

That's because it uses the first value it finds in the effective pom, which is the one from the Sonatype parent.

To fix this, I would recommend binding the execution of the Sonatype defined id enforce-maven against phase none (to effectively disable it). Alternatively the checkstyle pom execution id could be changed to enforce-maven to overwrite the parent configuration.

UPDATE: If I get it right, that parent POM is deprecated, so just removing it would of course also fix this issue: https://github.com/sonatype/oss-parents

@romani
Copy link
Member

romani commented Jan 30, 2024

I thought parent pom was required to be able to deploy artifacts to maven central. Is it not an issue anymore?

@Bananeweizen
Copy link
Contributor Author

Bananeweizen commented Jan 30, 2024

That was true in the past, but is deprecated now: https://central.sonatype.org/publish/publish-maven/#deprecated-oss-parent. The paragraphs below and above show how to reach the same by putting the necessary information into your own pom.

@nrmancuso
Copy link
Member

Let's just remove parent pom if this doesn't cause any issues.

MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Jan 31, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 1, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Feb 2, 2024
@nrmancuso
Copy link
Member

@romani I am good to approve based on findings at #14397, please add label if you agree

@MANISH-K-07
Copy link
Contributor

MANISH-K-07 commented Feb 5, 2024

@romani I am good to approve based on findings at #14397, please add label if you agree

@romani , @nrmancuso

Sorry to bother....
I have multiple successful open PRs which are ready to merge but I won't be bugging any of you about those.

This PR #14397 however resolves this unique issue in our project. Please Ping

@nrmancuso
Copy link
Member

I have multiple successful open PRs which are ready to merge but I won't be bugging any of you about those.

Isn't this "bugging"? 😂 We still need approval from @romani on this issue.

nrmancuso pushed a commit to MANISH-K-07/checkstyle that referenced this issue Feb 23, 2024
@github-actions github-actions bot added this to the 10.14.0 milestone Feb 27, 2024
romani added a commit that referenced this issue Feb 27, 2024
@romani romani reopened this Feb 27, 2024
@romani
Copy link
Member

romani commented Feb 27, 2024

we reverted changes as it caused problems for release - https://github.com/checkstyle/checkstyle/actions/runs/8066068513/job/22033791002#step:6:399

    [INFO] Performing remote staging...
    [INFO] 
    [INFO]  * Remote staging into staging profile ID "aeb23e7bacef6f"
    [INFO]  * Created staging repository with ID "compuppycrawltools-1140".
    [INFO]  * Staging repository at https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/compuppycrawltools-1140
    [INFO]  * Uploading locally staged artifacts to profile com.puppycrawl.tools
    [INFO]  * Upload of locally staged artifacts finished.
    [INFO]  * Closing staging repository with ID "compuppycrawltools-1140".
    
    Waiting for operation to complete...
    ...........
    
Error: ROR] Rule failure while trying to close staging repository with ID "compuppycrawltools-1140".
Error: ROR] 
Error: ROR] Nexus Staging Rules Failure Report
Error: ROR] ==================================
Error: ROR] 
Error: ROR] Repository "compuppycrawltools-1140" failures
Error: ROR]   Rule "signature-staging" failures
Error: ROR]     * Missing Signature: '/com/puppycrawl/tools/checkstyle/10.14.0/checkstyle-10.14.0-tests.jar.asc' does not exist for 'checkstyle-10.14.0-tests.jar'.
Error: ROR]     * Missing Signature: '/com/puppycrawl/tools/checkstyle/10.14.0/checkstyle-10.14.0.jar.asc' does not exist for 'checkstyle-10.14.0.jar'.
Error: ROR]     * Missing Signature: '/com/puppycrawl/tools/checkstyle/10.14.0/checkstyle-10.14.0-sources.jar.asc' does not exist for 'checkstyle-10.14.0-sources.jar'.
Error: ROR]     * Missing Signature: '/com/puppycrawl/tools/checkstyle/10.14.0/checkstyle-10.14.0-test-sources.jar.asc' does not exist for 'checkstyle-10.14.0-test-sources.jar'.
Error: ROR]     * Missing Signature: '/com/puppycrawl/tools/checkstyle/10.14.0/checkstyle-10.14.0.pom.asc' does not exist for 'checkstyle-10.14.0.pom'.
Error: ROR]   Rule "javadoc-staging" failures
Error: ROR]     * Missing: no javadoc jar found in folder '/com/puppycrawl/tools/checkstyle/10.14.0'
Error: ROR] 
Error: ROR] 
Error: ROR] Cleaning up local stage directory after a Rule failure during close of staging repositories: [compuppycrawltools-1140]
Error: ROR]  * Deleting context aeb23e7bacef6f.properties
Error: ROR] Cleaning up remote stage repositories after a Rule failure during close of staging repositories: [compuppycrawltools-1140]
Error: ROR]  * Dropping failed staging repository with ID "compuppycrawltools-1140" (Rule failure during close of staging repositories: [compuppycrawltools-1140]).
    
    Waiting for operation to complete...
    ...
    
Error: ROR] Remote staging finished with a failure: Staging rules failure!
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  02:18 min
    [INFO] Finished at: 2024-02-27T14:22:04Z
    [INFO] ------------------------------------------------------------------------
Error: ROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy (injected-nexus-deploy) on project checkstyle: Remote staging failed: Staging rules failure! -> [Help 1]
Error: ROR] 
Error: ROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: ROR] Re-run Maven using the -X switch to enable full debug logging.
Error: ROR] 
Error: ROR] For more information about the errors and possible solutions, please read the following articles:
Error: ROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:09 min
[INFO] Finished at: 2024-02-27T14:22:04Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:perform (default-cli) on project checkstyle: Maven execution failed, exit code: '1' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:perform (default-cli) on project checkstyle: Maven execution failed, exit code: '1'
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
    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:299)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:199)
    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:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Maven execution failed, exit code: '1'
    at org.apache.maven.plugins.release.PerformReleaseMojo.execute (PerformReleaseMojo.java:136)
    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:299)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:199)
    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:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: Maven execution failed, exit code: '1'
    at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute (AbstractRunGoalsPhase.java:90)
    at org.apache.maven.shared.release.phase.RunPerformGoalsPhase.execute (RunPerformGoalsPhase.java:67)
    at org.apache.maven.shared.release.DefaultReleaseManager.perform (DefaultReleaseManager.java:343)
    at org.apache.maven.shared.release.DefaultReleaseManager.perform (DefaultReleaseManager.java:289)
    at org.apache.maven.shared.release.DefaultReleaseManager.perform (DefaultReleaseManager.java:269)
    at org.apache.maven.plugins.release.PerformReleaseMojo.execute (PerformReleaseMojo.java:132)
    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:299)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:199)
    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:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.shared.release.exec.MavenExecutorException: Maven execution failed, exit code: '1'
    at org.apache.maven.shared.release.exec.ForkedMavenExecutor.executeGoals (ForkedMavenExecutor.java:122)
    at org.apache.maven.shared.release.exec.AbstractMavenExecutor.executeGoals (AbstractMavenExecutor.java:47)
    at org.apache.maven.shared.release.exec.ForkedMavenExecutor.executeGoals (ForkedMavenExecutor.java:144)
    at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute (AbstractRunGoalsPhase.java:82)
    at org.apache.maven.shared.release.phase.RunPerformGoalsPhase.execute (RunPerformGoalsPhase.java:67)
    at org.apache.maven.shared.release.DefaultReleaseManager.perform (DefaultReleaseManager.java:343)
    at org.apache.maven.shared.release.DefaultReleaseManager.perform (DefaultReleaseManager.java:289)
    at org.apache.maven.shared.release.DefaultReleaseManager.perform (DefaultReleaseManager.java:269)
    at org.apache.maven.plugins.release.PerformReleaseMojo.execute (PerformReleaseMojo.java:132)
    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:299)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:199)
    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:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Error:  
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/MojoExecutionException
Error: Process completed with exit code 1.

@MANISH-K-07
Copy link
Contributor

we reverted changes as it caused problems for release - https://github.com/checkstyle/checkstyle/actions/runs/8066068513/job/22033791002#step:6:399

This seems deeper than what I had anticipated ..

@romani , Is there anything I could do to help ?

kalpadiptyaroy pushed a commit to kalpadiptyaroy/checkstyle that referenced this issue Feb 27, 2024
kalpadiptyaroy pushed a commit to kalpadiptyaroy/checkstyle that referenced this issue Feb 27, 2024
@romani
Copy link
Member

romani commented Feb 28, 2024

@MANISH-K-07 ,

Is there anything I could do to help ?

we still need to investigate and fix this problem.

@romani
Copy link
Member

romani commented Feb 28, 2024

  • Missing: no javadoc jar found in folder '/com/puppycrawl/tools/checkstyle/10.14.0'

looks like parent pom defined some config for javadoc generation, and we need to restore it.

@MANISH-K-07
Copy link
Contributor

Sure, I'll try to browse through the sonatype-oss pom to root out the issue !!

Is there any way to test the config enhancement once its done? Since the CI we use obviously couldn't help with this

@MANISH-K-07
Copy link
Contributor

Is there any way to test the config enhancement once its done? Since the CI we use obviously couldn't help with this

@romani ? It would be helpful if I could test my changes for working..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment