Avoid failure of maven compilation if empty args are passed
#KT-54822 Fixed Merge-request: KT-MR-8103 Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
8c5739739c
commit
d26b96afe1
+10
-9
@@ -251,19 +251,16 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
||||
String valueString;
|
||||
if (value instanceof Object[]) {
|
||||
valueString = Arrays.deepToString((Object[]) value);
|
||||
}
|
||||
else if (value != null) {
|
||||
} else if (value != null) {
|
||||
valueString = String.valueOf(value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
valueString = "(null)";
|
||||
}
|
||||
|
||||
getLog().debug(f.getName() + "=" + valueString);
|
||||
}
|
||||
getLog().debug("End of arguments");
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
getLog().warn("Failed to print compiler arguments: " + e, e);
|
||||
}
|
||||
}
|
||||
@@ -277,6 +274,7 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
||||
|
||||
protected abstract void configureSpecificCompilerArguments(@NotNull A arguments, @NotNull List<File> sourceRoots) throws MojoExecutionException;
|
||||
|
||||
@NotNull
|
||||
private List<String> getCompilerPluginClassPaths() {
|
||||
ArrayList<String> result = new ArrayList<>();
|
||||
|
||||
@@ -443,10 +441,13 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
||||
|
||||
configureSpecificCompilerArguments(arguments, sourceRoots);
|
||||
|
||||
if (args != null && args.contains(null)) {
|
||||
throw new MojoExecutionException("Empty compiler argument passed in the <configuration> section");
|
||||
}
|
||||
|
||||
try {
|
||||
compiler.parseArguments(ArrayUtil.toStringArray(args), arguments);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new MojoExecutionException(e.getMessage());
|
||||
}
|
||||
|
||||
@@ -455,7 +456,7 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
||||
}
|
||||
|
||||
List<String> pluginClassPaths = getCompilerPluginClassPaths();
|
||||
if (pluginClassPaths != null && !pluginClassPaths.isEmpty()) {
|
||||
if (!pluginClassPaths.isEmpty()) {
|
||||
if (arguments.getPluginClasspaths() == null || arguments.getPluginClasspaths().length == 0) {
|
||||
arguments.setPluginClasspaths(pluginClassPaths.toArray(new String[pluginClassPaths.size()]));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user