Skip to content
Permalink
Browse files
all file add Apache License header
  • Loading branch information
EricJoy2048 committed Jun 16, 2020
1 parent 9643853 commit 983517e4f5b3ac0b2b74e5dad70285b5ea092631
Showing 1 changed file with 16 additions and 13 deletions.
@@ -77,7 +77,7 @@ public void execute() throws MojoExecutionException {
return;
}

Set<String> spiDependencies = getSpiDependencies();
Set<String> spiDependencies = getTheSpiDependencies();
getLog().debug("SPI dependencies: " + spiDependencies);

for (Artifact artifact : mavenProject.getArtifacts()) {
@@ -102,7 +102,7 @@ else if ("provided".equals(artifact.getScope()) && !allowedProvidedDependencies.
}
}

private Set<String> getSpiDependencies()
private Set<String> getTheSpiDependencies()
throws MojoExecutionException
{
return getArtifactDependencies(getSpiDependency())
@@ -117,8 +117,9 @@ private CollectResult getArtifactDependencies(Artifact artifact)
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 @@ private Artifact getSpiDependency()
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()

0 comments on commit 983517e

Please sign in to comment.