MCOMPILER-385: Initialise compilerArgs once in CompilerMojo
diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
index bba63c0..d59685c 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -256,18 +256,18 @@
{
pathElements.put( entry.getKey().getPath(), entry.getValue() );
}
-
+
+ if ( compilerArgs == null )
+ {
+ compilerArgs = new ArrayList<>();
+ }
+
for ( File file : resolvePathsResult.getClasspathElements() )
{
classpathElements.add( file.getPath() );
if ( multiReleaseOutput )
{
- if ( compilerArgs == null )
- {
- compilerArgs = new ArrayList<>();
- }
-
if ( getOutputDirectory().toPath().startsWith( file.getPath() ) )
{
compilerArgs.add( "--patch-module" );
@@ -286,10 +286,6 @@
modulepathElements.add( file.getPath() );
}
- if ( compilerArgs == null )
- {
- compilerArgs = new ArrayList<>();
- }
compilerArgs.add( "--module-version" );
compilerArgs.add( getProject().getVersion() );