michael-o commented on code in PR #201:
URL:
https://github.com/apache/maven-plugin-tools/pull/201#discussion_r1167634187
##########
maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java:
##########
@@ -570,23 +572,26 @@ 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()) {
- getLogger()
- .warn("Unable to get sources artifact for " +
artifact.getGroupId() + ":"
- + artifact.getArtifactId() + ":" +
artifact.getVersion()
- + ". Some javadoc tags (@since, @deprecated
and comments) won't be used");
+ classifier,
+ artifact.getArtifactHandler().getExtension(),
+ artifact.getVersion());
+
+ ArtifactRequest resolveRequest =
+ new ArtifactRequest(sourcesArtifact,
request.getProject().getRemoteProjectRepositories(), null);
+ try {
+ ArtifactResult result =
repositorySystem.resolveArtifact(request.getRepoSession(), resolveRequest);
+ sourcesArtifact = result.getArtifact();
+ } catch (ArtifactResolutionException e) {
+ String message = "Unable to get sources artifact for " +
artifact.getId()
+ + ". Some javadoc tags (@since, @deprecated and
comments) won't be used";
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug(message, e);
Review Comment:
This isn't actually what I mean. My expectation was:
```java
String message = "Unable to get sources artifact for " +
artifact.getId()
+ ". Some javadoc tags (@since, @deprecated and
comments) won't be used";
if (getLogger().isDebugEnabled()) {
getLogger().warn(message, e);
} else {
getLogger().warn(message);
}
```
Log level remains the same, but you will see the cause, if desired.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]