kordamp / pomchecker

🦉 Maven POM syntax checker
Apache License 2.0
60 stars 8 forks source link

Maven central rules: Inherited <url> or <description> from parent pom should not fail the build #15

Closed ge0ffrey closed 1 year ago

ge0ffrey commented 1 year ago

When validating an artifact with a pom that lacks an <url> or <description> element, but inherits it from its parent pom, the maven central rules should not fail.

Currently, even though it says "Will use computed value from parent:", it fails the build in pomchecker in JReleaser:

[INFO] Deploying Maven artifacts
[INFO]   [maven] Deploying all staged artifacts
[INFO]     [nexus2] Deploying to maven-central
Error:     [nexus2] PomChecker detected errors in timefold-solver-quarkus-jsonb-integration-test-0.9.39.pom
Error:  <url> is not defined in POM. Will use computed value from parent: 
    https://timefold.ai/timefold-solver-quarkus-jsonb-parent/timefold-solver-quarkus-jsonb-integration-test
Error:     [nexus2] PomChecker detected errors in timefold-solver-quarkus-benchmark-0.9.39.pom
Error:  <url> is not defined in POM. Will use computed value from parent: 
    https://timefold.ai/timefold-solver-quarkus-benchmark-parent/timefold-solver-quarkus-benchmark
Error:     [nexus2] PomChecker detected errors in timefold-solver-quarkus-jsonb-parent-0.9.39.pom
Error:  <description> is not defined in POM. Will use value from parent: 
    Timefold solves planning problems.
    This lightweight, embeddable planning engine implements powerful and scalable algorithms
    to optimize business resource scheduling and planning.

    This module contains the Quarkus integration modules.
<url> is not defined in POM. Will use computed value from parent: 
    https://timefold.ai/timefold-solver-quarkus-jsonb-parent
...
Error:     [nexus2] PomChecker detected errors in timefold-solver-quarkus-jackson-integration-test-0.9.39.pom
Error:  <url> is not defined in POM. Will use computed value from parent: 
    https://timefold.ai/timefold-solver-quarkus-jackson-parent/timefold-solver-quarkus-jackson-integration-test
[INFO] Writing output properties to target/jreleaser/output.properties
Error:  JReleaser failed after 01:10 m

Proposal A): report these as warnings, not errors.

Proposal B): do not report these at all, it's fine. For example, repeating the <url> in every child pom of a maven multiproject would violate DRY.

ge0ffrey commented 1 year ago

Downstream issue in JReleaser: https://github.com/jreleaser/jreleaser/issues/1397

aalmiray commented 1 year ago

Pomchecker offers 2 flags --fail-on-error and --fail-on-warning that can also be invoked in negated form https://kordamp.org/pomchecker/pomchecker-cli/index.html

The default setting is to fail on error and warning https://github.com/kordamp/pomchecker/blob/2577609ef49adb0873932393a50e80f6afe0d5b1/pomchecker-cli/src/main/java/org/kordamp/maven/checker/cli/CheckMavenCentral.java#L45

aalmiray commented 1 year ago

Closing as complete.