Make kotlin-runtime dependency optional for kotlin script executor for maven, but still add if it's found.
This commit is contained in:
+7
-3
@@ -270,21 +270,25 @@ public class ExecuteKotlinScriptMojo extends AbstractMojo {
|
|||||||
Artifact stdlibDep = null;
|
Artifact stdlibDep = null;
|
||||||
Artifact runtimeDep = null;
|
Artifact runtimeDep = null;
|
||||||
|
|
||||||
|
ArrayList<File> files = new ArrayList<File>(2);
|
||||||
|
|
||||||
for (Artifact dep: project.getArtifacts()) {
|
for (Artifact dep: project.getArtifacts()) {
|
||||||
if (dep.getArtifactId().equals("kotlin-stdlib")) {
|
if (dep.getArtifactId().equals("kotlin-stdlib")) {
|
||||||
|
files.add(getArtifactFile(dep));
|
||||||
stdlibDep = dep;
|
stdlibDep = dep;
|
||||||
}
|
}
|
||||||
if (dep.getArtifactId().equals("kotlin-runtime")) {
|
if (dep.getArtifactId().equals("kotlin-runtime")) {
|
||||||
|
files.add(getArtifactFile(dep));
|
||||||
runtimeDep = dep;
|
runtimeDep = dep;
|
||||||
}
|
}
|
||||||
if (stdlibDep != null && runtimeDep != null) break;
|
if (stdlibDep != null && runtimeDep != null) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stdlibDep == null || runtimeDep == null) {
|
if (stdlibDep == null) {
|
||||||
throw new MojoExecutionException("Unable to find kotlin-stdlib and kotlin-runtime artifacts among project dependencies");
|
throw new MojoExecutionException("Unable to find kotlin-stdlib artifacts among project dependencies");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Arrays.asList(getArtifactFile(stdlibDep), getArtifactFile(runtimeDep));
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCompiler() {
|
private void initCompiler() {
|
||||||
|
|||||||
Reference in New Issue
Block a user