This is an automated email from the ASF dual-hosted git repository. lgcareer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler-maven-plugin.git
commit 983517e4f5b3ac0b2b74e5dad70285b5ea092631 Author: gaojun2048 <540957...@qq.com> AuthorDate: Tue Jun 16 12:23:24 2020 +0800 all file add Apache License header --- .../maven/SpiDependencyChecker.java | 29 ++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/apache/dolphinscheduler/maven/SpiDependencyChecker.java b/src/main/java/org/apache/dolphinscheduler/maven/SpiDependencyChecker.java index 62452ff..6e5ea27 100644 --- a/src/main/java/org/apache/dolphinscheduler/maven/SpiDependencyChecker.java +++ b/src/main/java/org/apache/dolphinscheduler/maven/SpiDependencyChecker.java @@ -77,7 +77,7 @@ public class SpiDependencyChecker extends AbstractMojo { return; } - Set<String> spiDependencies = getSpiDependencies(); + Set<String> spiDependencies = getTheSpiDependencies(); getLog().debug("SPI dependencies: " + spiDependencies); for (Artifact artifact : mavenProject.getArtifacts()) { @@ -102,7 +102,7 @@ public class SpiDependencyChecker extends AbstractMojo { } } - private Set<String> getSpiDependencies() + private Set<String> getTheSpiDependencies() throws MojoExecutionException { return getArtifactDependencies(getSpiDependency()) @@ -117,8 +117,9 @@ public class SpiDependencyChecker extends AbstractMojo { throws MojoExecutionException { try { - Dependency dependency = new Dependency(aetherArtifact(artifact), null); - return repositorySystem.collectDependencies(repositorySession, new CollectRequest(dependency, null)); + org.eclipse.aether.artifact.Artifact artifact1 = aetherArtifact(artifact); + Dependency projectDependency = new Dependency(artifact1, null); + return repositorySystem.collectDependencies(repositorySession, new CollectRequest(projectDependency, null)); } catch (DependencyCollectionException e) { throw new MojoExecutionException("Failed to resolve dependencies.", e); @@ -129,22 +130,24 @@ public class SpiDependencyChecker extends AbstractMojo { throws MojoExecutionException { for (Artifact artifact : mavenProject.getArtifacts()) { - if (isSpiArtifact(artifact)) { - if (!"provided".equals(artifact.getScope())) { - throw new MojoExecutionException(String.format("DolphinScheduler plugin dependency %s must have scope 'provided'.", spiName())); - } - return artifact; + if (!isSpiArtifact(artifact)) { + continue; + } + + if (!"provided".equals(artifact.getScope())) { + throw new MojoExecutionException(String.format("DolphinScheduler plugin dependency %s must have scope 'provided'.", spiName())); } + return artifact; } throw new MojoExecutionException(String.format("DolphinScheduler plugin must depend on %s.", spiName())); } private boolean isSpiArtifact(Artifact artifact) { - return spiGroupId.equals(artifact.getGroupId()) && - spiArtifactId.equals(artifact.getArtifactId()) && - "jar".equals(artifact.getType()) && - (artifact.getClassifier() == null); + return spiGroupId.equals(artifact.getGroupId()) + && spiArtifactId.equals(artifact.getArtifactId()) + && "jar".equals(artifact.getType()) + && (artifact.getClassifier() == null); } private String spiName()