Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[MJAVADOC-742] Fix resolution of docletArtifacts #186

Merged
merged 4 commits into from
Sep 11, 2023
Merged

[MJAVADOC-742] Fix resolution of docletArtifacts #186

merged 4 commits into from
Sep 11, 2023

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Feb 23, 2023

Transitive deps were not resovled.


https://issues.apache.org/jira/browse/MJAVADOC-742

@cstamas cstamas self-assigned this Feb 23, 2023
@@ -3242,8 +3241,11 @@ private List<String> getArtifactsAbsolutePath(JavadocPathArtifact javadocArtifac

DependencyFilter filter = new ScopeDependencyFilter(
Arrays.asList(Artifact.SCOPE_COMPILE, Artifact.SCOPE_PROVIDED), Collections.emptySet());
DependencyRequest req =
new DependencyRequest(new DefaultDependencyNode(RepositoryUtils.toArtifact(artifact)), filter);
DependencyRequest req = new DependencyRequest(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an IT for doclets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to take over the PR, I verified it against the user provided reproducer in MJAVADOC-742

@elharo
Copy link
Contributor

elharo commented Mar 15, 2023

Test failures look related:

 Error:  Errors: 
Error:    JavadocReportTest.testTagletArtifacts:1120 » NullPointer
[INFO] 
Error:  Tests run: 68, Failures: 0, Errors: 1, Skipped: 0
[INFO] 

@slawekjaranowski
Copy link
Member

Error:  org.apache.maven.plugins.javadoc.JavadocReportTest.testTagletArtifacts -- Time elapsed: 0.728 s <<< ERROR!
java.lang.NullPointerException
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:361)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getArtifactsAbsolutePath(AbstractJavadocMojo.java:3259)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getTagletPath(AbstractJavadocMojo.java:2932)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.addStandardDocletOptions(AbstractJavadocMojo.java:4863)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1957)
	at org.apache.maven.plugins.javadoc.JavadocReport.generate(JavadocReport.java:135)
	at org.apache.maven.plugins.javadoc.JavadocReport.doExecute(JavadocReport.java:309)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.execute(AbstractJavadocMojo.java:1824)
	at org.apache.maven.plugins.javadoc.JavadocReportTest.testTagletArtifacts(JavadocReportTest.java:1096)

@kwin
Copy link
Member

kwin commented Sep 11, 2023

The NPE noted above can only be reproduced on JDK8 (the test method is skipped with JDK11 or above). It happens because DependencyResult.getRoot() returns null (compare with https://issues.apache.org/jira/browse/MRESOLVER-19). The underlying (swallowed) exception is

org.eclipse.aether.collection.DependencyCollectionException: Failed to read artifact descriptor for org.codehaus.plexus:plexus-javadoc:jar:1.0
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:208)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:341)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getArtifactsAbsolutePath(AbstractJavadocMojo.java:3259)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getTagletPath(AbstractJavadocMojo.java:2932)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.addStandardDocletOptions(AbstractJavadocMojo.java:4863)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1957)
	at org.apache.maven.plugins.javadoc.JavadocReport.generate(JavadocReport.java:135)
	at org.apache.maven.plugins.javadoc.JavadocReport.doExecute(JavadocReport.java:309)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.execute(AbstractJavadocMojo.java:1824)
	at org.apache.maven.plugins.javadoc.JavadocReportTest.testTagletArtifacts(JavadocReportTest.java:1096)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at junit.framework.TestCase.runTest(TestCase.java:177)
	at junit.framework.TestCase.runBare(TestCase.java:142)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:130)
	at junit.framework.TestSuite.runTest(TestSuite.java:241)
	at junit.framework.TestSuite.run(TestSuite.java:236)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.plexus:plexus-javadoc:jar:1.0
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:202)
	... 28 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.codehaus.plexus:plexus-javadoc:pom:1.0
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287)
	... 30 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.codehaus.plexus:plexus-javadoc:pom:1.0
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434)
	... 33 more
org.eclipse.aether.collection.DependencyCollectionException: Failed to read artifact descriptor for org.codehaus.plexus:plexus-javadoc:jar:1.0
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:208)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:341)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getArtifactsAbsolutePath(AbstractJavadocMojo.java:3259)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getTagletPath(AbstractJavadocMojo.java:2932)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.addStandardDocletOptions(AbstractJavadocMojo.java:4863)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1957)
	at org.apache.maven.plugins.javadoc.JavadocReport.generate(JavadocReport.java:135)
	at org.apache.maven.plugins.javadoc.JavadocReport.doExecute(JavadocReport.java:309)
	at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.execute(AbstractJavadocMojo.java:1824)
	at org.apache.maven.plugins.javadoc.JavadocReportTest.testTagletArtifacts(JavadocReportTest.java:1096)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at junit.framework.TestCase.runTest(TestCase.java:177)
	at junit.framework.TestCase.runBare(TestCase.java:142)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:130)
	at junit.framework.TestSuite.runTest(TestSuite.java:241)
	at junit.framework.TestSuite.run(TestSuite.java:236)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.plexus:plexus-javadoc:jar:1.0
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:202)
	... 28 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.codehaus.plexus:plexus-javadoc:pom:1.0
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287)
	... 30 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.codehaus.plexus:plexus-javadoc:pom:1.0
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434)
	... 33 more

@kwin kwin merged commit 24362d2 into master Sep 11, 2023
@kwin kwin deleted the MJAVADOC-742 branch September 11, 2023 18:28
@cstamas
Copy link
Member Author

cstamas commented Sep 11, 2023

Thank you all!

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

Successfully merging this pull request may close these issues.

6 participants