Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ protected void resolveXJCPluginArtifacts()
this.xjcPluginArtifacts = ArtifactUtils.resolveTransitively(
getArtifactFactory(), getRepositorySystem(),
getMavenSession().getLocalRepository(), getArtifactMetadataSource(),
getPlugins(), getProject(), getArtifactExcludes());
getPlugins(), getProject(), getLog(), getArtifactExcludes());
this.xjcPluginFiles = ArtifactUtils.getFiles(this.xjcPluginArtifacts);
this.xjcPluginURLs = CollectionUtils.apply(this.xjcPluginFiles, IOUtils.GET_URL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugin.logging.SystemStreamLog;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.artifact.MavenMetadataSource;
Expand All @@ -40,6 +42,7 @@ public static Collection<Artifact> resolveTransitively(
artifactFactory, artifactResolver,
localRepository, artifactMetadataSource,
dependencies, project,
new SystemStreamLog(),
null);
}

Expand All @@ -49,10 +52,11 @@ public static Collection<Artifact> resolveTransitively(
final ArtifactRepository localRepository,
final ArtifactMetadataSource artifactMetadataSource,
final Dependency[] dependencies, final MavenProject project,
final Log log,
final String[] artifactExcludes)
throws InvalidDependencyVersionException,
ArtifactResolutionException, ArtifactNotFoundException {
if (dependencies == null) {
if (dependencies == null || dependencies.length == 0) {
return Collections.emptyList();
}

Expand All @@ -74,9 +78,19 @@ public static Collection<Artifact> resolveTransitively(

final ArtifactResolutionResult artifactResolutionResult = artifactResolver.resolve(request);

final Set<Artifact> resolvedArtifacts = artifactResolutionResult.getArtifacts();

return resolvedArtifacts;
if (!artifactResolutionResult.isSuccess()) {
if (artifactResolutionResult.hasMissingArtifacts()) {
log.error("artifactResolutionResult has missing artifacts : " + artifactResolutionResult.getMissingArtifacts());
throw new RuntimeException("Artifacts - missing artifacts");
} else if (artifactResolutionResult.hasExceptions()) {
log.error("artifactResolutionResult has exceptions : " + artifactResolutionResult.getExceptions());
throw new RuntimeException("Artifacts - exceptions", artifactResolutionResult.getExceptions().get(0));
} else {
log.error("artifactResolutionResult status is not success");
throw new RuntimeException("Artifacts - not in success");
}
}
return artifactResolutionResult.getArtifacts();
}

public static Collection<Artifact> resolve(
Expand All @@ -87,7 +101,7 @@ public static Collection<Artifact> resolve(
final Dependency[] dependencies, final MavenProject project)
throws InvalidDependencyVersionException,
ArtifactResolutionException, ArtifactNotFoundException {
if (dependencies == null) {
if (dependencies == null || dependencies.length == 0) {
return Collections.emptyList();
}

Expand Down
Loading