From dev-return-127065-archive-asf-public=cust-asf.ponee.io@maven.apache.org Sat Nov 17 18:03:25 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7CBDB180658 for ; Sat, 17 Nov 2018 18:03:24 +0100 (CET) Received: (qmail 5984 invoked by uid 500); 17 Nov 2018 17:03:23 -0000 Mailing-List: contact dev-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Developers List" Reply-To: "Maven Developers List" Delivered-To: mailing list dev@maven.apache.org Received: (qmail 5968 invoked by uid 99); 17 Nov 2018 17:03:22 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Nov 2018 17:03:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 2F68E1806CE; Sat, 17 Nov 2018 17:03:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.339 X-Spam-Level: X-Spam-Status: No, score=0.339 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-1.459, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id daQFLs6Te54T; Sat, 17 Nov 2018 17:03:19 +0000 (UTC) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 2793E5FB31; Sat, 17 Nov 2018 17:03:19 +0000 (UTC) Received: by mail-wr1-f51.google.com with SMTP id u9-v6so27875190wrr.0; Sat, 17 Nov 2018 09:03:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bs9v1P+RFhNdty15Kh2lCPRb/wuBJc9buUWyp/Ewl0w=; b=uG/VOJ8lb93tdt/haLpFYYPqBt8HkwIaYctAGtIfaNU8Fwk2q61sYHTryzBzE9cV61 m5M70J721e12djOLmQEKyDa2ChEP451em31orGgPfLLZRkIhVUDG5tgLGL1jTLNJ9Dc4 kw00mua2GvfvXOmjDcw016k1IKUAAdBcJEL758OUJz+a4km44u6bv5TSs0IbqDxck9r8 3LozieqNE5ZpchcdBZfjoIsHSqAV83isFhTdAbHEBAghN6WYBf35LuLyBbm0y2IcJQWO G1t4dSanSZLFhtrdKVDPHXM4jT/i1eA9d5nxCFhJeFDttGAgxQ8opl7oYyGSGQDvMXhR /vWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bs9v1P+RFhNdty15Kh2lCPRb/wuBJc9buUWyp/Ewl0w=; b=TiM5mPWoumQ2mTgi3kdsxTbv5cF63GGRodOopf2RJbB2gTCa0WhVS0iXi4gp5AHi+e r4tGOFDU1T1OgzBEwd82DgLwfrf15V6k3SNKTbOLm0+jmFKq/aYi6Z+jDhzEjAFRO1f3 /Xl6r+S4w1KvEPjS3F0DTF+Yi+oec1JHNRuItGiu6aOjGtxFC/2Upby2KY87M58Bhx2q OPUSbByFppi4MT2tLHMpY5QxPLe4sUSgRMhtPUBs1k1Ma9RAZZ39GfVkyjOoFQJM5GsP xScnQIeNun2q7xSVPDl8OPArSelWHvLTSiqOBFIZWT2Xnk6/FDPxFHOT/nGlOz71h+cB Nm+w== X-Gm-Message-State: AA+aEWaQE1OdJK4kt8nPn+7Ua4Yde/BkDcw33w7+QiSo6uGzb7RA+F0F pUInPRvjcwXVb9cBDHvqR2fO9PHddE7ybr9+1QxtPw== X-Google-Smtp-Source: AFSGD/USOH7b/EtwQtujbPMMfemarciy+KLPnT8MH3tYJgZV1WnQbvdYHpHtONMX3HtTKhH/MLOhpATYyc8NdCgKbaM= X-Received: by 2002:a05:6000:120a:: with SMTP id e10mr11156192wrx.85.1542474191991; Sat, 17 Nov 2018 09:03:11 -0800 (PST) MIME-Version: 1.0 References: <154245088248.27977.13283779848284286537@gitbox.apache.org> <20181117103442.91C25850D1@gitbox.apache.org> In-Reply-To: From: Enrico Olivelli Date: Sat, 17 Nov 2018 18:03:00 +0100 Message-ID: Subject: Re: [maven-surefire] 01/01: [SUREFIRE-1531] Option to disable Java 9 modules To: Maven Developers List Cc: Robert Scholte , commits@maven.apache.org Content-Type: multipart/alternative; boundary="00000000000049f8cf057adf42fd" --00000000000049f8cf057adf42fd Content-Type: text/plain; charset="UTF-8" +1 Enrico Il sab 17 nov 2018, 18:01 Tibor Digana ha scritto: > Hi Robert, > Sorry I have not seen your email before. > " useModulePath " sounds good. I will rename the property if no objections. > > BR > Tibor > > On Sat, Nov 17, 2018 at 1:00 PM Robert Scholte > wrote: > > > On Sat, 17 Nov 2018 11:34:43 +0100, wrote: > > > > > This is an automated email from the ASF dual-hosted git repository. > > > > > > tibordigana pushed a commit to branch SUREFIRE-1531 > > > in repository https://gitbox.apache.org/repos/asf/maven-surefire.git > > > > > > commit f333b7d9e89ddfe086fd1cb930df0f77a0edbc96 > > > Author: Lukas Krecan > > > AuthorDate: Sun Jul 1 08:54:22 2018 +0200 > > > > > > [SUREFIRE-1531] Option to disable Java 9 modules > > > --- > > > .../maven/plugin/failsafe/IntegrationTestMojo.java | 23 ++++++++++ > > > .../plugin/surefire/AbstractSurefireMojo.java | 53 > > > +++++++++++++++------- > > > .../AbstractSurefireMojoJava7PlusTest.java | 12 +++++ > > > .../plugin/surefire/AbstractSurefireMojoTest.java | 12 +++++ > > > .../maven/plugin/surefire/MojoMocklessTest.java | 12 +++++ > > > .../maven/plugin/surefire/SurefirePlugin.java | 23 ++++++++++ > > > 6 files changed, 119 insertions(+), 16 deletions(-) > > > > > > diff --git > > > > > > a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java > > > > > > > > b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java > > > index 52f9052..42b4cc6 100644 > > > --- > > > > > > a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java > > > +++ > > > > > > b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java > > > @@ -370,6 +370,17 @@ public class IntegrationTestMojo > > > @Parameter( property = "failsafe.shutdown", defaultValue = > > > "testset" ) > > > private String shutdown; > > > + /** > > > + * Disables Jigsaw (Java 9) modular path even if > > > module-info.java is used in project. > > > + *
> > > + * Enabled by default. > > > + * If enabled, module-info.java exists and executes with > > JDK > > > 9+, modular path is used. > > > + * > > > + * @since 3.0.0-M2 > > > + */ > > > + @Parameter( property = "failsafe.useJigsawModules", defaultValue = > > > "true" ) > > > + private boolean useJigsawModules; > > > + > > > > > > I think we should avoid referring to Jigsaw, that was the name of the > > project. > > I'd prefer useJavaModules instead, or maybe even useModulePath. > > > > > > > @Override > > > protected int getRerunFailingTestsCount() > > > { > > > @@ -801,6 +812,18 @@ public class IntegrationTestMojo > > > } > > > @Override > > > + protected boolean useJigsawModules() > > > + { > > > + return useJigsawModules; > > > + } > > > + > > > + @Override > > > + protected void setUseJigsawModules( boolean useJigsawModules ) > > > + { > > > + this.useJigsawModules = useJigsawModules; > > > + } > > > + > > > + @Override > > > protected final List suiteXmlFiles() > > > { > > > return hasSuiteXmlFiles() ? Arrays.asList( suiteXmlFiles ) : > > > Collections.emptyList(); > > > 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 319f21d..4a1a213 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 > > > @@ -104,6 +104,7 @@ import java.util.SortedSet; > > > import java.util.TreeSet; > > > import java.util.concurrent.ConcurrentHashMap; > > > +import static java.lang.Boolean.TRUE; > > > import static java.lang.Thread.currentThread; > > > import static java.util.Arrays.asList; > > > import static java.util.Collections.addAll; > > > @@ -728,6 +729,9 @@ public abstract class AbstractSurefireMojo > > > @Parameter( property = "dependenciesToScan" ) > > > private String[] dependenciesToScan; > > > + /** > > > + * > > > + */ > > > @Component > > > private ToolchainManager toolchainManager; > > > @@ -787,6 +791,10 @@ public abstract class AbstractSurefireMojo > > > protected abstract String getReportSchemaLocation(); > > > + protected abstract boolean useJigsawModules(); > > > + > > > + protected abstract void setUseJigsawModules( boolean > > > useJigsawModules ); > > > + > > > /** > > > * This plugin MOJO artifact. > > > * > > > @@ -954,7 +962,7 @@ public abstract class AbstractSurefireMojo > > > if ( !getTestClassesDirectory().exists() > > > && ( getDependenciesToScan() == null || > > > getDependenciesToScan().length == 0 ) ) > > > { > > > - if ( Boolean.TRUE.equals( getFailIfNoTests() ) ) > > > + if ( TRUE.equals( getFailIfNoTests() ) ) > > > { > > > throw new MojoFailureException( "No tests to run!" ); > > > } > > > @@ -1123,17 +1131,18 @@ public abstract class AbstractSurefireMojo > > > RunOrderParameters runOrderParameters = > > > new RunOrderParameters( getRunOrder(), getStatisticsFile( > > > getConfigChecksum() ) ); > > > + Platform platform = PLATFORM.withJdkExecAttributesForTests( > > > getEffectiveJvm() ); > > > if ( isNotForking() ) > > > { > > > createCopyAndReplaceForkNumPlaceholder( > > > effectiveProperties, 1 ).copyToSystemProperties(); > > > InPluginVMSurefireStarter surefireStarter = > > > - createInprocessStarter( provider, > > > classLoaderConfiguration, runOrderParameters, scanResult ); > > > + createInprocessStarter( provider, > > > classLoaderConfiguration, runOrderParameters, scanResult, platform ); > > > return surefireStarter.runSuitesInProcess( scanResult ); > > > } > > > else > > > { > > > - ForkConfiguration forkConfiguration = > > > getForkConfiguration(); > > > + ForkConfiguration forkConfiguration = > > > createForkConfiguration( platform ); > > > if ( getConsoleLogger().isDebugEnabled() ) > > > { > > > showMap( getEnvironmentVariables(), "environment > > > variable" ); > > > @@ -1144,7 +1153,7 @@ public abstract class AbstractSurefireMojo > > > try > > > { > > > forkStarter = createForkStarter( provider, > > > forkConfiguration, classLoaderConfiguration, > > > - > > > runOrderParameters, getConsoleLogger(), scanResult ); > > > + > > > runOrderParameters, getConsoleLogger(), scanResult, platform ); > > > return forkStarter.run( effectiveProperties, scanResult > > > ); > > > } > > > @@ -1231,6 +1240,13 @@ public abstract class AbstractSurefireMojo > > > return new File( getClassesDirectory(), "module-info.class" ); > > > } > > > + private boolean canExecuteProviderWithJigsaw( Platform platform ) > > > + { > > > + return useJigsawModules() > > > + && > > > platform.getJdkExecAttributesForTests().isJava9AtLeast() > > > + && existsModuleDescriptor(); > > > + } > > > + > > > /** > > > * Converts old TestNG configuration parameters over to new > > > properties based configuration > > > * method. (if any are defined the old way) > > > @@ -1683,18 +1699,18 @@ public abstract class AbstractSurefireMojo > > > private StartupConfiguration createStartupConfiguration( @Nonnull > > > ProviderInfo provider, boolean isInprocess, > > > @Nonnull > > > ClassLoaderConfiguration classLoaderConfiguration, > > > - @Nonnull > > > DefaultScanResult scanResult ) > > > + @Nonnull > > > DefaultScanResult scanResult, > > > + @Nonnull > > > Platform platform ) > > > throws MojoExecutionException > > > { > > > try > > > { > > > - File moduleDescriptor = getModuleDescriptor(); > > > Set providerArtifacts = > > > provider.getProviderClasspath(); > > > String providerName = provider.getProviderName(); > > > - if ( moduleDescriptor.exists() && !isInprocess ) > > > + if ( canExecuteProviderWithJigsaw( platform ) && > > > !isInprocess ) > > > { > > > return newStartupConfigWithModularPath( > > > classLoaderConfiguration, providerArtifacts, providerName, > > > - moduleDescriptor, scanResult ); > > > + getModuleDescriptor(), scanResult ); > > > } > > > else > > > { > > > @@ -2107,11 +2123,11 @@ public abstract class AbstractSurefireMojo > > > private ForkStarter createForkStarter( @Nonnull ProviderInfo > > > provider, @Nonnull ForkConfiguration forkConfiguration, > > > @Nonnull > > > ClassLoaderConfiguration classLoaderConfiguration, > > > @Nonnull RunOrderParameters > > > runOrderParameters, @Nonnull ConsoleLogger log, > > > - @Nonnull DefaultScanResult > > > scanResult ) > > > + @Nonnull DefaultScanResult > > > scanResult, @Nonnull Platform platform ) > > > throws MojoExecutionException, MojoFailureException > > > { > > > StartupConfiguration startupConfiguration = > > > - createStartupConfiguration( provider, false, > > > classLoaderConfiguration, scanResult ); > > > + createStartupConfiguration( provider, false, > > > classLoaderConfiguration, scanResult, platform ); > > > String configChecksum = getConfigChecksum(); > > > StartupReportConfiguration startupReportConfiguration = > > > getStartupReportConfiguration( configChecksum, true ); > > > ProviderConfiguration providerConfiguration = > > > createProviderConfiguration( runOrderParameters ); > > > @@ -2122,11 +2138,12 @@ public abstract class AbstractSurefireMojo > > > private InPluginVMSurefireStarter createInprocessStarter( @Nonnull > > > ProviderInfo provider, > > > @Nonnull > > > ClassLoaderConfiguration classLoaderConfig, > > > @Nonnull > > > RunOrderParameters runOrderParameters, > > > - @Nonnull > > > DefaultScanResult scanResult ) > > > + @Nonnull > > > DefaultScanResult scanResult, > > > + @Nonnull > > > Platform platform ) > > > throws MojoExecutionException, MojoFailureException > > > { > > > StartupConfiguration startupConfiguration = > > > - createStartupConfiguration( provider, true, > > > classLoaderConfig, scanResult ); > > > + createStartupConfiguration( provider, true, > > > classLoaderConfig, scanResult, platform ); > > > String configChecksum = getConfigChecksum(); > > > StartupReportConfiguration startupReportConfiguration = > > > getStartupReportConfiguration( configChecksum, false ); > > > ProviderConfiguration providerConfiguration = > > > createProviderConfiguration( runOrderParameters ); > > > @@ -2135,7 +2152,7 @@ public abstract class AbstractSurefireMojo > > > } > > > @Nonnull > > > - private ForkConfiguration getForkConfiguration() throws > > > MojoFailureException > > > + private ForkConfiguration createForkConfiguration( Platform > > > platform ) > > > { > > > File tmpDir = getSurefireTempDir(); > > > @@ -2143,9 +2160,7 @@ public abstract class AbstractSurefireMojo > > > Classpath bootClasspath = getArtifactClasspath( shadeFire != > > > null ? shadeFire : surefireBooterArtifact ); > > > - Platform platform = PLATFORM.withJdkExecAttributesForTests( > > > getEffectiveJvm() ); > > > - > > > - if ( platform.getJdkExecAttributesForTests().isJava9AtLeast() > > > && existsModuleDescriptor() ) > > > + if ( canExecuteProviderWithJigsaw( platform ) ) > > > { > > > return new ModularClasspathForkConfiguration( > bootClasspath, > > > tmpDir, > > > @@ -2414,6 +2429,7 @@ public abstract class AbstractSurefireMojo > > > checksum.add( getForkedProcessExitTimeoutInSeconds() ); > > > checksum.add( getRerunFailingTestsCount() ); > > > checksum.add( getTempDir() ); > > > + checksum.add( useJigsawModules() ); > > > addPluginSpecificChecksumItems( checksum ); > > > return checksum.getSha1(); > > > } > > > @@ -3479,6 +3495,11 @@ public abstract class AbstractSurefireMojo > > > this.dependenciesToScan = dependenciesToScan; > > > } > > > + public PluginDescriptor getPluginDescriptor() > > > + { > > > + return pluginDescriptor; > > > + } > > > + > > > public MavenProject getProject() > > > { > > > return project; > > > 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 f73124a..b3dc339 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 > > > @@ -560,6 +560,18 @@ public class AbstractSurefireMojoJava7PlusTest > > > } > > > @Override > > > + protected boolean useJigsawModules() > > > + { > > > + return false; > > > + } > > > + > > > + @Override > > > + protected void setUseJigsawModules( boolean useJigsawModules ) > > > + { > > > + > > > + } > > > + > > > + @Override > > > protected Artifact getMojoArtifact() > > > { > > > return null; > > > 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 de62c60..8514269 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 > > > @@ -705,6 +705,18 @@ public class AbstractSurefireMojoTest > > > } > > > @Override > > > + protected boolean useJigsawModules() > > > + { > > > + return false; > > > + } > > > + > > > + @Override > > > + protected void setUseJigsawModules( boolean useJigsawModules ) > > > + { > > > + > > > + } > > > + > > > + @Override > > > protected Artifact getMojoArtifact() > > > { > > > return null; > > > diff --git > > > > > > a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java > > > > > > > > b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java > > > index 597527b..e555b00 100644 > > > --- > > > > > > a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java > > > +++ > > > > > > b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java > > > @@ -612,6 +612,18 @@ public class MojoMocklessTest > > > } > > > @Override > > > + protected boolean useJigsawModules() > > > + { > > > + return false; > > > + } > > > + > > > + @Override > > > + protected void setUseJigsawModules( boolean useJigsawModules ) > > > + { > > > + > > > + } > > > + > > > + @Override > > > protected Artifact getMojoArtifact() > > > { > > > return null; > > > diff --git > > > > > > a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java > > > > > > > > b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java > > > index 73ea01e..7fbbe20 100644 > > > --- > > > > > > a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java > > > +++ > > > > > > b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java > > > @@ -349,6 +349,17 @@ public class SurefirePlugin > > > @Parameter( property = "surefire.shutdown", defaultValue = > > > "testset" ) > > > private String shutdown; > > > + /** > > > + * Disables Jigsaw (Java 9) modular path even if > > > module-info.java is used in project. > > > + *
> > > + * Enabled by default. > > > + * If enabled, module-info.java exists and executes with > > JDK > > > 9+, modular path is used. > > > + * > > > + * @since 3.0.0-M2 > > > + */ > > > + @Parameter( property = "surefire.useJigsawModules", defaultValue = > > > "true" ) > > > + private boolean useJigsawModules; > > > + > > > @Override > > > protected int getRerunFailingTestsCount() > > > { > > > @@ -703,6 +714,18 @@ public class SurefirePlugin > > > } > > > @Override > > > + protected boolean useJigsawModules() > > > + { > > > + return useJigsawModules; > > > + } > > > + > > > + @Override > > > + protected void setUseJigsawModules( boolean useJigsawModules ) > > > + { > > > + this.useJigsawModules = useJigsawModules; > > > + } > > > + > > > + @Override > > > protected final List suiteXmlFiles() > > > { > > > return hasSuiteXmlFiles() ? Arrays.asList( suiteXmlFiles ) : > > > Collections.emptyList(); > > > -- -- Enrico Olivelli --00000000000049f8cf057adf42fd--