[maven-surefire] branch SUREFIRE-1733 updated: impl jvm args

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-surefire] branch SUREFIRE-1733 updated: impl jvm args

Tibor Digana
This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch SUREFIRE-1733
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/SUREFIRE-1733 by this push:
     new 1fae10a  impl jvm args
1fae10a is described below

commit 1fae10ad667757a1da71394abf0da2aff1570f17
Author: tibordigana <[hidden email]>
AuthorDate: Sat May 23 02:02:34 2020 +0200

    impl jvm args
---
 .../plugin/surefire/AbstractSurefireMojo.java      | 97 +++++++++++++++++-----
 ...iderInfo.java => ProviderForkRequirements.java} | 40 +++++----
 .../apache/maven/plugin/surefire/ProviderInfo.java |  3 +
 .../booterclient/DefaultForkConfiguration.java     |  6 ++
 .../AbstractSurefireMojoJava7PlusTest.java         | 14 ++--
 .../plugin/surefire/AbstractSurefireMojoTest.java  |  6 +-
 ...ooterDeserializerProviderConfigurationTest.java |  3 +-
 ...BooterDeserializerStartupConfigurationTest.java |  5 +-
 .../booterclient/DefaultForkConfigurationTest.java |  4 +-
 .../booterclient/ForkConfigurationTest.java        |  8 +-
 .../ModularClasspathForkConfigurationTest.java     |  2 +-
 .../surefire/booter/StartupConfiguration.java      | 13 ++-
 12 files changed, 150 insertions(+), 51 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index c5d18de..8b4f25d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1882,18 +1882,15 @@ public abstract class AbstractSurefireMojo
     {
         try
         {
-            Set<Artifact> providerArtifacts = provider.getProviderClasspath();
-            String providerName = provider.getProviderName();
             if ( isForking && canExecuteProviderWithModularPath( platform, resolvedJavaModularity ) )
             {
                 File jdkHome = platform.getJdkExecAttributesForTests().getJdkHome();
-                return newStartupConfigWithModularPath( classLoaderConfiguration, providerArtifacts, providerName,
-                    resolvedJavaModularity, scanResult, jdkHome.getAbsolutePath(), testClasspathWrapper );
+                return newStartupConfigWithModularPath( classLoaderConfiguration, provider, resolvedJavaModularity,
+                    scanResult, jdkHome.getAbsolutePath(), testClasspathWrapper );
             }
             else
             {
-                return newStartupConfigWithClasspath( classLoaderConfiguration, providerArtifacts, providerName,
-                        testClasspathWrapper );
+                return newStartupConfigWithClasspath( classLoaderConfiguration, provider, testClasspathWrapper );
             }
         }
         catch ( IOException e )
@@ -1903,11 +1900,12 @@ public abstract class AbstractSurefireMojo
     }
 
     private StartupConfiguration newStartupConfigWithClasspath(
-            @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull Set<Artifact> providerArtifacts,
-            @Nonnull String providerName, @Nonnull TestClassPath testClasspathWrapper )
+        @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull ProviderInfo providerInfo,
+        @Nonnull TestClassPath testClasspathWrapper ) throws MojoExecutionException
     {
         Classpath testClasspath = testClasspathWrapper.toClasspath();
-
+        Set<Artifact> providerArtifacts = providerInfo.getProviderClasspath();
+        String providerName = providerInfo.getProviderName();
         Classpath providerClasspath = classpathCache.getCachedClassPath( providerName );
         if ( providerClasspath == null )
         {
@@ -1928,9 +1926,9 @@ public abstract class AbstractSurefireMojo
 
         ClasspathConfiguration classpathConfiguration = new ClasspathConfiguration( testClasspath, providerClasspath,
                 inProcClasspath, effectiveIsEnableAssertions(), isChildDelegation() );
-
+        ProviderForkRequirements forkRequirements = new ProviderForkRequirements( false, false, false );
         return new StartupConfiguration( providerName, classpathConfiguration, classLoaderConfiguration,
-            ProcessCheckerType.toEnum( getEnableProcessChecker() ) );
+            ProcessCheckerType.toEnum( getEnableProcessChecker() ), providerInfo.getJvmArgs( forkRequirements ) );
     }
 
     private static Set<Artifact> retainInProcArtifactsUnique( Set<Artifact> providerArtifacts,
@@ -1982,26 +1980,29 @@ public abstract class AbstractSurefireMojo
     }
 
     private StartupConfiguration newStartupConfigWithModularPath(
-        @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull Set<Artifact> providerArtifacts,
-        @Nonnull String providerName, @Nonnull ResolvePathResultWrapper moduleDescriptor,
-        @Nonnull DefaultScanResult scanResult, @Nonnull String javaHome, @Nonnull TestClassPath testClasspathWrapper )
-            throws IOException
+        @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull ProviderInfo providerInfo,
+        @Nonnull ResolvePathResultWrapper moduleDescriptor, @Nonnull DefaultScanResult scanResult,
+        @Nonnull String javaHome, @Nonnull TestClassPath testClasspathWrapper )
+            throws MojoExecutionException, IOException
     {
         boolean isMainDescriptor = moduleDescriptor.isMainModuleDescriptor();
         JavaModuleDescriptor javaModuleDescriptor = moduleDescriptor.getResolvePathResult().getModuleDescriptor();
         SortedSet<String> packages = new TreeSet<>();
 
         Classpath testClasspath = testClasspathWrapper.toClasspath();
-
+        Set<Artifact> providerArtifacts = providerInfo.getProviderClasspath();
+        String providerName = providerInfo.getProviderName();
         Classpath providerClasspath = classpathCache.getCachedClassPath( providerName );
         if ( providerClasspath == null )
         {
             providerClasspath = classpathCache.setCachedClasspath( providerName, providerArtifacts );
         }
 
-        Classpath testModulepath;
+        final ProviderForkRequirements forkRequirements;
+        final Classpath testModulepath;
         if ( isMainDescriptor )
         {
+            forkRequirements = new ProviderForkRequirements( true, true, false );
             ResolvePathsRequest<String> req = ResolvePathsRequest.ofStrings( testClasspath.getClassPath() )
                     .setJdkHome( javaHome )
                     .setModuleDescriptor( javaModuleDescriptor );
@@ -2024,6 +2025,7 @@ public abstract class AbstractSurefireMojo
         }
         else
         {
+            forkRequirements = new ProviderForkRequirements( true, false, true );
             testModulepath = testClasspath;
             testClasspath = emptyClasspath();
         }
@@ -2051,7 +2053,7 @@ public abstract class AbstractSurefireMojo
         getConsoleLogger().debug( inProcClasspath.getCompactLogMessage( "in-process(compact) classpath:" ) );
 
         return new StartupConfiguration( providerName, classpathConfiguration, classLoaderConfiguration,
-            ProcessCheckerType.toEnum( getEnableProcessChecker() ) );
+            ProcessCheckerType.toEnum( getEnableProcessChecker() ), providerInfo.getJvmArgs( forkRequirements ) );
     }
 
     private Artifact getCommonArtifact()
@@ -2362,7 +2364,7 @@ public abstract class AbstractSurefireMojo
                                            @Nonnull RunOrderParameters runOrderParameters, @Nonnull ConsoleLogger log,
                                            @Nonnull DefaultScanResult scanResult,
                                            @Nonnull TestClassPath testClasspathWrapper, @Nonnull Platform platform,
-                                           ResolvePathResultWrapper resolvedJavaModularityResult )
+                                           @Nonnull ResolvePathResultWrapper resolvedJavaModularityResult )
         throws MojoExecutionException, MojoFailureException
     {
         StartupConfiguration startupConfiguration = createStartupConfiguration( provider, true,
@@ -3057,6 +3059,13 @@ public abstract class AbstractSurefireMojo
             convertTestNGParameters();
         }
 
+        @Nonnull
+        @Override
+        public String[] getJvmArgs( @Nonnull ProviderForkRequirements forkRequirements )
+        {
+            return new String[0];
+        }
+
         @Override
         @Nonnull
         public Set<Artifact> getProviderClasspath()
@@ -3087,6 +3096,13 @@ public abstract class AbstractSurefireMojo
         {
         }
 
+        @Nonnull
+        @Override
+        public String[] getJvmArgs( @Nonnull ProviderForkRequirements forkRequirements )
+        {
+            return new String[0];
+        }
+
         @Override
         @Nonnull
         public Set<Artifact> getProviderClasspath()
@@ -3128,6 +3144,13 @@ public abstract class AbstractSurefireMojo
         {
         }
 
+        @Nonnull
+        @Override
+        public String[] getJvmArgs( @Nonnull ProviderForkRequirements forkRequirements )
+        {
+            return new String[0];
+        }
+
         @Override
         @Nonnull
         public Set<Artifact> getProviderClasspath()
@@ -3171,6 +3194,14 @@ public abstract class AbstractSurefireMojo
             convertGroupParameters();
         }
 
+        @Nonnull
+        @Override
+        public String[] getJvmArgs( @Nonnull ProviderForkRequirements forkRequirements )
+        {
+            boolean hasTestDescriptor = forkRequirements.isModularPath() && forkRequirements.hasTestModuleDescriptor();
+            return hasTestDescriptor ? new String[0] : getJpmsArgs();
+        }
+
         @Override
         @Nonnull
         public Set<Artifact> getProviderClasspath() throws MojoExecutionException
@@ -3227,6 +3258,20 @@ public abstract class AbstractSurefireMojo
             return new LinkedHashSet<>( providerArtifacts.values() );
         }
 
+        private String[] getJpmsArgs()
+        {
+            return new String[] {
+                "--add-modules",
+                "ALL-MODULE-PATH",
+
+                "--add-opens",
+                "org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED",
+
+                "--add-opens",
+                "org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED"
+            };
+        }
+
         private void addEngineByApi( String engineGroupId, String engineArtifactId, String engineVersion,
                                      Map<String, Artifact> providerArtifacts )
         {
@@ -3324,6 +3369,13 @@ public abstract class AbstractSurefireMojo
             convertGroupParameters();
         }
 
+        @Nonnull
+        @Override
+        public String[] getJvmArgs( @Nonnull ProviderForkRequirements forkRequirements )
+        {
+            return new String[0];
+        }
+
         @Override
         @Nonnull
         public Set<Artifact> getProviderClasspath()
@@ -3373,6 +3425,13 @@ public abstract class AbstractSurefireMojo
             convertTestNGParameters();
         }
 
+        @Nonnull
+        @Override
+        public String[] getJvmArgs( @Nonnull ProviderForkRequirements forkRequirements )
+        {
+            return new String[0];
+        }
+
         @Override
         @Nonnull
         public Set<Artifact> getProviderClasspath() throws MojoExecutionException
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderForkRequirements.java
similarity index 51%
copy from maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
copy to maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderForkRequirements.java
index fea74fd..a29da2d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderForkRequirements.java
@@ -19,24 +19,36 @@ package org.apache.maven.plugin.surefire;
  * under the License.
  */
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-
-import javax.annotation.Nonnull;
-import java.util.Set;
-
 /**
- * @author Kristian Rosenvold
+ * Used to get additional provider-specific JVM arguments.
+ *
+ * @see ProviderInfo#getJvmArgs(ProviderForkRequirements)
  */
-public interface ProviderInfo
+final class ProviderForkRequirements
 {
-    @Nonnull
-    String getProviderName();
+    private final boolean modularPath;
+    private final boolean mainModuleDescriptor;
+    private final boolean testModuleDescriptor;
+
+    ProviderForkRequirements( boolean modularPath, boolean mainModuleDescriptor, boolean testModuleDescriptor )
+    {
+        this.modularPath = modularPath;
+        this.mainModuleDescriptor = mainModuleDescriptor;
+        this.testModuleDescriptor = testModuleDescriptor;
+    }
 
-    boolean isApplicable();
+    boolean isModularPath()
+    {
+        return modularPath;
+    }
 
-    @Nonnull
-    Set<Artifact> getProviderClasspath() throws MojoExecutionException;
+    boolean hasMainModuleDescriptor()
+    {
+        return mainModuleDescriptor;
+    }
 
-    void addProviderProperties() throws MojoExecutionException;
+    boolean hasTestModuleDescriptor()
+    {
+        return testModuleDescriptor;
+    }
 }
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
index fea74fd..4c76dbc 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
@@ -39,4 +39,7 @@ public interface ProviderInfo
     Set<Artifact> getProviderClasspath() throws MojoExecutionException;
 
     void addProviderProperties() throws MojoExecutionException;
+
+    @Nonnull
+    String[] getJvmArgs( @Nonnull ProviderForkRequirements forkRequirements );
 }
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
index a2c38b8..3f94084 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
@@ -153,6 +153,12 @@ public abstract class DefaultForkConfiguration
                     .setLine( jvmArgLine );
         }
 
+        for ( String arg : config.getProviderForkArgs() )
+        {
+            cli.createArg()
+                .setValue( arg );
+        }
+
         if ( getDebugLine() != null && !getDebugLine().isEmpty() )
         {
             cli.createArg()
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
index d02c7fd..0254440 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
@@ -134,10 +134,10 @@ public class AbstractSurefireMojoJava7PlusTest
         ClassLoaderConfiguration classLoaderConfiguration = new ClassLoaderConfiguration( false, true );
 
         VersionRange v5 = createFromVersion( "1" );
-        Artifact provider = new DefaultArtifact( "org.apache.maven.surefire", "surefire-provider", v5, "runtime",
-                "jar", "", handler );
-        provider.setFile( mockFile( "surefire-provider.jar" ) );
-        Set<Artifact> providerClasspath = singleton( provider );
+        Artifact providerArtifact = new DefaultArtifact( "org.apache.maven.surefire", "surefire-provider",
+            v5, "runtime", "jar", "", handler );
+        providerArtifact.setFile( mockFile( "surefire-provider.jar" ) );
+        Set<Artifact> providerClasspath = singleton( providerArtifact );
 
         ResolvePathResult moduleInfo = mock( ResolvePathResult.class );
         when( moduleInfo.getModuleDescriptor() ).thenReturn( descriptor );
@@ -205,8 +205,12 @@ public class AbstractSurefireMojoJava7PlusTest
         artifacts.put( "org.apache.maven.surefire:surefire-shared-utils", utils );
         when( mojo.getPluginArtifactMap() ).thenReturn( artifacts );
 
+        ProviderInfo providerInfo = mock( ProviderInfo.class );
+        when( providerInfo.getProviderName() ).thenReturn( "org.asf.Provider" );
+        when( providerInfo.getProviderClasspath() ).thenReturn( providerClasspath );
+
         StartupConfiguration conf = invokeMethod( mojo, "newStartupConfigWithModularPath",
-            classLoaderConfiguration, providerClasspath, "org.asf.Provider",
+            classLoaderConfiguration, providerInfo,
             new ResolvePathResultWrapper( moduleInfo, true ), scanResult, "", testClasspath );
 
         verify( mojo, times( 1 ) ).effectiveIsEnableAssertions();
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
index f747091..1fd97ff 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
@@ -529,8 +529,12 @@ public class AbstractSurefireMojoTest
         doNothing().when( logger ).debug( anyString() );
         when( mojo.getConsoleLogger() ).thenReturn( new PluginConsoleLogger( logger ) );
 
+        ProviderInfo providerInfo = mock( ProviderInfo.class );
+        when( providerInfo.getProviderName() ).thenReturn( "org.asf.Provider" );
+        when( providerInfo.getProviderClasspath() ).thenReturn( providerArtifacts );
+
         StartupConfiguration conf = invokeMethod( mojo, "newStartupConfigWithClasspath",
-                classLoaderConfiguration, providerArtifacts, "org.asf.Provider", testClasspath );
+                classLoaderConfiguration, providerInfo, testClasspath );
 
         verify( mojo, times( 1 ) ).effectiveIsEnableAssertions();
         verify( mojo, times( 1 ) ).isChildDelegation();
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
index ac3eba5..e4f3acc 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
@@ -286,7 +286,8 @@ public class BooterDeserializerProviderConfigurationTest
     {
         ClasspathConfiguration classpathConfiguration = new ClasspathConfiguration( true, true );
 
-        return new StartupConfiguration( "com.provider", classpathConfiguration, classLoaderConfiguration, ALL );
+        return new StartupConfiguration( "com.provider", classpathConfiguration, classLoaderConfiguration, ALL,
+            new String[0] );
     }
 
     private File getTestSourceDirectory()
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
index 5a2d6cf..58d4614 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
@@ -142,7 +142,7 @@ public class BooterDeserializerStartupConfigurationTest
     public void testProcessCheckerNull() throws IOException
     {
         StartupConfiguration startupConfiguration = new StartupConfiguration( "com.provider", classpathConfiguration,
-                getManifestOnlyJarForkConfiguration(), null );
+                getManifestOnlyJarForkConfiguration(), null, new String[0] );
         assertNull( saveAndReload( startupConfiguration ).getProcessChecker() );
     }
 
@@ -204,7 +204,8 @@ public class BooterDeserializerStartupConfigurationTest
 
     private StartupConfiguration getTestStartupConfiguration( ClassLoaderConfiguration classLoaderConfiguration )
     {
-        return new StartupConfiguration( "com.provider", classpathConfiguration, classLoaderConfiguration, ALL );
+        return new StartupConfiguration( "com.provider", classpathConfiguration, classLoaderConfiguration, ALL,
+            new String[0] );
     }
 
     private File getTestSourceDirectory()
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java
index 45a6b4a..8ffd892 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java
@@ -307,7 +307,7 @@ public class DefaultForkConfigurationTest
         ClassLoaderConfiguration clc = new ClassLoaderConfiguration( true, true );
         ClasspathConfiguration cc = new ClasspathConfiguration( true, true );
         StartupConfiguration conf = new StartupConfiguration( "org.apache.maven.shadefire.surefire.MyProvider",
-                cc, clc, null );
+                cc, clc, null, new String[0] );
         StartupConfiguration confMock = spy( conf );
         mockStatic( Relocator.class );
         when( Relocator.relocate( anyString() ) ).thenCallRealMethod();
@@ -328,7 +328,7 @@ public class DefaultForkConfigurationTest
         ClassLoaderConfiguration clc = new ClassLoaderConfiguration( true, true );
         ClasspathConfiguration cc = new ClasspathConfiguration( true, true );
         StartupConfiguration conf =
-                new StartupConfiguration( "org.apache.maven.surefire.MyProvider", cc, clc, null );
+                new StartupConfiguration( "org.apache.maven.surefire.MyProvider", cc, clc, null, new String[0] );
         StartupConfiguration confMock = spy( conf );
         mockStatic( Relocator.class );
         when( Relocator.relocate( anyString() ) ).thenCallRealMethod();
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
index bc01ee8..f2bfe48 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
@@ -57,7 +57,7 @@ public class ForkConfigurationTest
 {
     private static final StartupConfiguration STARTUP_CONFIG = new StartupConfiguration( "",
             new ClasspathConfiguration( true, true ),
-            new ClassLoaderConfiguration( true, true ), ALL );
+            new ClassLoaderConfiguration( true, true ), ALL, new String[0] );
 
     private static int idx = 0;
 
@@ -90,7 +90,7 @@ public class ForkConfigurationTest
         ClasspathConfiguration cpConfig = new ClasspathConfiguration( new Classpath( cp ), emptyClasspath(),
                 emptyClasspath(), true, true );
         ClassLoaderConfiguration clc = new ClassLoaderConfiguration( true, true );
-        StartupConfiguration startup = new StartupConfiguration( "", cpConfig, clc, ALL );
+        StartupConfiguration startup = new StartupConfiguration( "", cpConfig, clc, ALL, new String[0] );
 
         Commandline cli = config.createCommandLine( startup, 1, temporaryFolder() );
 
@@ -110,7 +110,7 @@ public class ForkConfigurationTest
         ClasspathConfiguration cpConfig = new ClasspathConfiguration( new Classpath( cp ), emptyClasspath(),
                 emptyClasspath(), true, true );
         ClassLoaderConfiguration clc = new ClassLoaderConfiguration( true, true );
-        StartupConfiguration startup = new StartupConfiguration( "", cpConfig, clc, ALL );
+        StartupConfiguration startup = new StartupConfiguration( "", cpConfig, clc, ALL, new String[0] );
 
         Commandline commandLine = config.createCommandLine( startup, 1, temporaryFolder() );
         assertTrue( commandLine.toString().contains( "abc def" ) );
@@ -125,7 +125,7 @@ public class ForkConfigurationTest
         ClasspathConfiguration cpConfig = new ClasspathConfiguration( emptyClasspath(), emptyClasspath(),
                 emptyClasspath(), true, true );
         ClassLoaderConfiguration clc = new ClassLoaderConfiguration( true, true );
-        StartupConfiguration startup = new StartupConfiguration( "", cpConfig, clc, ALL );
+        StartupConfiguration startup = new StartupConfiguration( "", cpConfig, clc, ALL, new String[0] );
         ForkConfiguration config = getForkConfiguration( cwd.getCanonicalFile() );
         Commandline commandLine = config.createCommandLine( startup, 1, temporaryFolder() );
 
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
index e09177b..519f700 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
@@ -144,7 +144,7 @@ public class ModularClasspathForkConfigurationTest
                         emptyClasspath(), true, true );
         ClassLoaderConfiguration clc = new ClassLoaderConfiguration( true, true );
         StartupConfiguration startupConfiguration = new StartupConfiguration( "JUnitCoreProvider",
-            modularClasspathConfiguration, clc, null );
+            modularClasspathConfiguration, clc, null, new String[0] );
         OutputStreamFlushableCommandline cli = new OutputStreamFlushableCommandline();
         config.resolveClasspath( cli, ForkedBooter.class.getName(), startupConfiguration,
                 createTempFile( "surefire", "surefire-reports" ) );
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
index d6a3dd0..846cb0b 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
@@ -34,16 +34,19 @@ public class StartupConfiguration
     private final AbstractPathConfiguration classpathConfiguration;
     private final ClassLoaderConfiguration classLoaderConfiguration;
     private final ProcessCheckerType processChecker;
+    private final String[] providerForkArgs;
 
     public StartupConfiguration( @Nonnull String providerClassName,
                                  @Nonnull AbstractPathConfiguration classpathConfiguration,
                                  @Nonnull ClassLoaderConfiguration classLoaderConfiguration,
-                                 ProcessCheckerType processChecker )
+                                 ProcessCheckerType processChecker,
+                                 @Nonnull String[] providerForkArgs )
     {
         this.classpathConfiguration = classpathConfiguration;
         this.classLoaderConfiguration = classLoaderConfiguration;
         this.providerClassName = providerClassName;
         this.processChecker = processChecker;
+        this.providerForkArgs = providerForkArgs;
     }
 
     public boolean isProviderMainClass()
@@ -56,7 +59,8 @@ public class StartupConfiguration
                                                    ClassLoaderConfiguration classLoaderConfig,
                                                    ProcessCheckerType processChecker )
     {
-        return new StartupConfiguration( providerClassName, classpathConfig, classLoaderConfig, processChecker );
+        return new StartupConfiguration( providerClassName, classpathConfig, classLoaderConfig,
+            processChecker, new String[0] );
     }
 
     public AbstractPathConfiguration getClasspathConfiguration()
@@ -133,4 +137,9 @@ public class StartupConfiguration
     {
         return processChecker;
     }
+
+    public String[] getProviderForkArgs()
+    {
+        return providerForkArgs;
+    }
 }