kordamp / pomchecker

🦉 Maven POM syntax checker
Apache License 2.0
65 stars 11 forks source link

Pomchecker does not resolve poms from the repository to be deployed #24

Closed gastaldi closed 2 months ago

gastaldi commented 2 months ago

I don't know if this belongs to https://github.com/jreleaser/jreleaser or here, but when deploying a multimodule project, Pomchecker does not resolve the dependencies from the same repository.

Having the following repository contents:

.
└── io
    └── quarkiverse
        └── slack
            ├── quarkus-slack
            │   ├── 0.0.2
            │   │   ├── quarkus-slack-0.0.2-javadoc.jar
            │   │   ├── quarkus-slack-0.0.2-javadoc.jar.md5
            │   │   ├── quarkus-slack-0.0.2-javadoc.jar.sha1
            │   │   ├── quarkus-slack-0.0.2-sources.jar
            │   │   ├── quarkus-slack-0.0.2-sources.jar.md5
            │   │   ├── quarkus-slack-0.0.2-sources.jar.sha1
            │   │   ├── quarkus-slack-0.0.2.jar
            │   │   ├── quarkus-slack-0.0.2.jar.md5
            │   │   ├── quarkus-slack-0.0.2.jar.sha1
            │   │   ├── quarkus-slack-0.0.2.pom
            │   │   ├── quarkus-slack-0.0.2.pom.md5
            │   │   └── quarkus-slack-0.0.2.pom.sha1
            │   ├── maven-metadata.xml
            │   ├── maven-metadata.xml.md5
            │   └── maven-metadata.xml.sha1
            ├── quarkus-slack-deployment
            │   ├── 0.0.2
            │   │   ├── quarkus-slack-deployment-0.0.2-javadoc.jar
            │   │   ├── quarkus-slack-deployment-0.0.2-javadoc.jar.md5
            │   │   ├── quarkus-slack-deployment-0.0.2-javadoc.jar.sha1
            │   │   ├── quarkus-slack-deployment-0.0.2-sources.jar
            │   │   ├── quarkus-slack-deployment-0.0.2-sources.jar.md5
            │   │   ├── quarkus-slack-deployment-0.0.2-sources.jar.sha1
            │   │   ├── quarkus-slack-deployment-0.0.2.jar
            │   │   ├── quarkus-slack-deployment-0.0.2.jar.md5
            │   │   ├── quarkus-slack-deployment-0.0.2.jar.sha1
            │   │   ├── quarkus-slack-deployment-0.0.2.pom
            │   │   ├── quarkus-slack-deployment-0.0.2.pom.md5
            │   │   └── quarkus-slack-deployment-0.0.2.pom.sha1
            │   ├── maven-metadata.xml
            │   ├── maven-metadata.xml.md5
            │   └── maven-metadata.xml.sha1
            ├── quarkus-slack-docs
            │   ├── 0.0.2
            │   │   ├── quarkus-slack-docs-0.0.2-sources.jar
            │   │   ├── quarkus-slack-docs-0.0.2-sources.jar.md5
            │   │   ├── quarkus-slack-docs-0.0.2-sources.jar.sha1
            │   │   ├── quarkus-slack-docs-0.0.2.jar
            │   │   ├── quarkus-slack-docs-0.0.2.jar.md5
            │   │   ├── quarkus-slack-docs-0.0.2.jar.sha1
            │   │   ├── quarkus-slack-docs-0.0.2.pom
            │   │   ├── quarkus-slack-docs-0.0.2.pom.md5
            │   │   └── quarkus-slack-docs-0.0.2.pom.sha1
            │   ├── maven-metadata.xml
            │   ├── maven-metadata.xml.md5
            │   └── maven-metadata.xml.sha1
            └── quarkus-slack-parent
                ├── 0.0.2
                │   ├── quarkus-slack-parent-0.0.2.pom
                │   ├── quarkus-slack-parent-0.0.2.pom.md5
                │   └── quarkus-slack-parent-0.0.2.pom.sha1
                ├── maven-metadata.xml
                ├── maven-metadata.xml.md5
                └── maven-metadata.xml.sha1

Gives the following output when PomChecker runs:

[INFO]  JReleaser 1.13.1
[INFO]  Configuring with jreleaser.yml
[INFO]    - basedir set to /home/runner/work/quarkiverse-release/quarkiverse-release
[INFO]    - outputdir set to /home/runner/work/quarkiverse-release/quarkiverse-release/out/jreleaser
[INFO]  Reading configuration
[INFO]  git-root-search set to false
[INFO]  Loading variables from /home/runner/.jreleaser/config.properties
[WARN]  Variables source /home/runner/.jreleaser/config.properties does not exist
[INFO]  Validating configuration
[INFO]  Strict mode set to false
[INFO]  Project version set to 0.0.2
[INFO]  Release is not snapshot
[INFO]  Timestamp is 2024-08-30T12:36:05.345995983Z
[INFO]  HEAD is at 8091b08
[INFO]  Platform is linux-x86_64
[INFO]  dry-run set to true
[INFO]  Deploying Maven artifacts
[INFO]    [maven] Deploying all staged artifacts
[INFO]      [nexus2] Deploying to maven-central
[INFO]      [nexus2] nexus2 set to FULL_DEPLOYMENT
[INFO]      [nexus2] Verifying prerequesites
[INFO]      [nexus2] Verifying POMs
Error:      [nexus2] java.lang.IllegalStateException: org.apache.maven.project.ProjectBuildingException: 1 problem was encountered while building the effective model for io.quarkiverse.slack:quarkus-slack-deployment:0.0.2
Error:      [nexus2] [FATAL] Non-resolvable parent POM for io.quarkiverse.slack:quarkus-slack-deployment:0.0.2: The following artifacts could not be resolved: io.quarkiverse.slack:quarkus-slack-parent:pom:0.0.2 (absent): Could not find artifact io.quarkiverse.slack:quarkus-slack-parent:pom:0.0.2 in central (https://repo.maven.apache.org/maven2/) and 'parent.relativePath' points at wrong local POM @ line 5, column 13
Error:      [nexus2]  for project io.quarkiverse.slack:quarkus-slack-deployment:0.0.2 at /home/runner/work/quarkiverse-release/quarkiverse-release/repository/io/quarkiverse/slack/quarkus-slack-deployment/0.0.2/quarkus-slack-deployment-0.0.2.pom
Error:      [nexus2]    at org.kordamp.maven.checker.cli.internal.PomParser.createMavenProject(PomParser.java:102)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.internal.PomParser.createMavenProject(PomParser.java:74)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.CheckMavenCentral.execute(CheckMavenCentral.java:61)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.AbstractCommand.call(AbstractCommand.java:102)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.CheckMavenCentral.call(CheckMavenCentral.java:30)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.AbstractCommand.call(AbstractCommand.java:34)
Error:      [nexus2]    at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
Error:      [nexus2]    at picocli.CommandLine.access$1500(CommandLine.java:[148](https://github.com/quarkiverse-release/quarkiverse-release/actions/runs/10632775102/job/29476421959#step:9:154))
Error:      [nexus2]    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
Error:      [nexus2]    at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
Error:      [nexus2]    at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
Error:      [nexus2]    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
Error:      [nexus2]    at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
Error:      [nexus2]    at picocli.CommandLine.execute(CommandLine.java:2170)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.Main.execute(Main.java:86)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.Main.run(Main.java:72)
Error:      [nexus2]    at org.kordamp.maven.checker.cli.Main.main(Main.java:64)

Meaning that it could not resolve the io.quarkiverse.slack:quarkus-slack-parent:pom:0.0.2 (which is not in central, obviously) while resolving io.quarkiverse.slack:quarkus-slack-deployment:0.0.2

aalmiray commented 2 months ago

I'd suspect this have to to with the move from Maven resolver to MIMA. @cstamas do you have an idea of what may be the cause of this issue?

I t looks like Pomchecker lost the ability to resolve artifacts from a local directory that's not explicitly listed as a local repository. Pomchcker evaluates files individually AFAICT and thus defining a location where other artifacts may be found (the staging directory configured in JReleaser) is not built-in behavior. I believe the expectation is to find parent poms using the value of <relativePath> by default, which in this case is undefined and results in the wrong parent pom search.

It may be the case that pomchecker requires adding an extra parameter for a local directory that defines a local repository that may be searched during model resolution.

cstamas commented 2 months ago

This was old code: https://github.com/kordamp/pomchecker/pull/20/files#diff-c2b667416488ee8da6c6cea7d47ab804bce3d1609a3bb8b692a9123608db088dL122-L130

and here is withUser(true) (so should pick up whatever is in settings.xml), or simple override should be added?

https://github.com/kordamp/pomchecker/pull/20/files#diff-c2b667416488ee8da6c6cea7d47ab804bce3d1609a3bb8b692a9123608db088dR71

aalmiray commented 2 months ago

🎉 This issue has been resolved in v1.13.0 (Release Notes)