michael-o commented on code in PR #201: URL: https://github.com/apache/maven-plugin-tools/pull/201#discussion_r1167619968
########## maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java: ########## @@ -360,8 +346,8 @@ public void generate() throws MojoExecutionException { request.setEncoding(encoding); request.setSkipErrorNoDescriptorsFound(skipErrorNoDescriptorsFound); request.setDependencies(filterMojoDependencies()); - request.setLocal(this.local); - request.setRemoteRepos(this.remoteRepos); + request.setRemoteRepos(project.getRemoteProjectRepositories()); + request.setRepoSession(repoSession); Review Comment: Stupid question: If we already pass the project in the ctor why then pass `project.getRemoteProjectRepositories()` which can be retrieved internally? ########## maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java: ########## @@ -570,22 +572,20 @@ protected void extendJavaProjectBuilderWithSourcesJar( JavaProjectBuilder builder, Artifact artifact, PluginToolsRequest request, String classifier) throws ExtractionException { try { - Artifact sourcesArtifact = repositorySystem.createArtifactWithClassifier( + org.eclipse.aether.artifact.Artifact sourcesArtifact = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), - artifact.getVersion(), - artifact.getType(), - classifier); - - ArtifactResolutionRequest req = new ArtifactResolutionRequest(); - req.setArtifact(sourcesArtifact); - req.setLocalRepository(request.getLocal()); - req.setRemoteRepositories(request.getRemoteRepos()); - ArtifactResolutionResult res = repositorySystem.resolve(req); - if (res.hasMissingArtifacts() || res.hasExceptions()) { + classifier, + artifact.getArtifactHandler().getExtension(), + artifact.getVersion()); + + ArtifactRequest resolveRequest = new ArtifactRequest(sourcesArtifact, request.getRemoteRepos(), null); + try { + ArtifactResult result = repositorySystem.resolveArtifact(request.getRepoSession(), resolveRequest); + sourcesArtifact = result.getArtifact(); + } catch (ArtifactResolutionException e) { getLogger() - .warn("Unable to get sources artifact for " + artifact.getGroupId() + ":" - + artifact.getArtifactId() + ":" + artifact.getVersion() + .warn("Unable to get sources artifact for " + artifact.getId() Review Comment: The exception should be logged here as well. Ieast when debug is enabled. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org