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

Spurious failure due to too strict error checking for artifact resolution #284

Closed
wardev opened this issue Mar 5, 2021 · 3 comments
Closed

Comments

@wardev
Copy link

wardev commented Mar 5, 2021

Hi,

First, thanks for making japicmp!

I have a pom with multiple repositories. One, of the repositories is inaccessible. The old version artifact is available from a repository further down the list. Maven's normal dependency resolution logic is fine with that, but japicmp is breaking the build. I think the problem is that the check at [1] is to strict. It checks if any errors occurred. In this case some errors occurred but the artifact was still resolved successfully. I think that line should just check if the artifact was resolved successfully. I've included below the debug output from maven which shows a successful download of the the old version artifact, and then japicmp breaking the build because it couldn't download the old version artifact.

Regards,
Evan

[1]

if (artifactResult.isMissing() || (artifactResult.getExceptions() != null && !artifactResult.getExceptions().isEmpty())){

[DEBUG] Could not find metadata myGroup:myArtifact/maven-metadata.xml in central (https://repo.maven.apache.org/maven2)
[debug] Parameter <oldVersionPattern> not configured, i.e. no version filtered.
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://myRepo/offline
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://myRepo/offline with username=user, password=***
Downloading from myRepo.offline: https://myRepo/offline/myGroup/myArtifact/11.2/myArtifact-11.2.jar
[DEBUG] Writing tracking file /home/user/.m2/repository/myGroup/myArtifact/11.2/myArtifact-11.2.jar.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://other-repo/online
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://other-repo/online
Downloading from other-repo: https://other-repo/online/myGroup/myArtifact/11.2/myArtifact-11.2.jar
Downloaded from other-repo: https://other-repo/online/myGroup/myArtifact/11.2/myArtifact-11.2.jar (364 kB at 375 kB/s)
[DEBUG] Writing tracking file /home/user/.m2/repository/myGroup/myArtifact/11.2/_remote.repositories
[DEBUG] Writing tracking file /home/user/.m2/repository/myGroup/myArtifact/11.2/myArtifact-11.2.jar.lastUpdated
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:34 min
[INFO] Finished at: 2021-03-05T14:17:38-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.9.1:site (default-site) on project myArtifact: Error generating japicmp-maven-plugin:0.15.2:cmp-report report: Failed to generate report: Could not resolve artifact: myGroup:myArtifact:jar:11.2 -> [Help 1]
@siom79
Copy link
Owner

siom79 commented Mar 6, 2021

Thanks for reporting this issue. Yes, you are right. The javadoc for the getExceptions() method says:

Gets the exceptions that occurred while resolving the artifact. Note that this list can be non-empty even if the artifact was successfully resolved, e.g. when one of the contacted remote repositories didn't contain the artifact but a later repository eventually contained it.

I will only log exception and not break the build

siom79 added a commit that referenced this issue Mar 6, 2021
… logged, the build is not broken

#283 the ignoreMissingArtifact option is evaluated properly when the artifact is missing
@siom79
Copy link
Owner

siom79 commented Mar 6, 2021

Fixed: 0.15.3

@wardev
Copy link
Author

wardev commented Mar 8, 2021

That worked! Thanks for the quick release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants