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 2ddc3ff inverstigation commit 2ddc3ff is described below commit 2ddc3ff312c0080058b09bc37780bf2f340ddb21 Author: tibordigana <tibordig...@apache.org> AuthorDate: Wed May 20 14:14:27 2020 +0200 inverstigation commit --- .../plugin/surefire/AbstractSurefireMojo.java | 82 +++++++++++++++------- .../booterclient/DefaultForkConfiguration.java | 9 ++- .../ModularClasspathForkConfiguration.java | 40 ++++++++++- .../plugin/surefire/AbstractSurefireMojoTest.java | 17 +++-- .../ModularClasspathForkConfigurationTest.java | 2 +- surefire-booter/pom.xml | 11 +++ .../apache/maven/surefire/booter/ForkedBooter.java | 11 ++- .../maven/surefire/booter/ModularClasspath.java | 13 +++- surefire-its/pom.xml | 2 +- .../com.foo.impl/pom.xml | 8 ++- .../com.foo.impl/src/main/java/module-info.java | 4 +- .../test/java/com/foo/{impl => implt}/BarIT.java | 4 +- .../test/java/com/foo/{impl => implt}/BarTest.java | 4 +- .../src/{main => test}/java/module-info.java | 16 ++++- .../maven-multimodule-project-with-jpms/pom.xml | 2 +- 15 files changed, 177 insertions(+), 48 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 003da19..f02986f 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 @@ -90,6 +90,7 @@ import org.apache.maven.toolchain.DefaultToolchain; import org.apache.maven.toolchain.Toolchain; import org.apache.maven.toolchain.ToolchainManager; import org.apache.maven.toolchain.java.DefaultJavaToolChain; +import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor; import org.codehaus.plexus.languages.java.jpms.ResolvePathRequest; import org.codehaus.plexus.languages.java.jpms.ResolvePathResult; import org.codehaus.plexus.logging.Logger; @@ -126,6 +127,8 @@ import static java.util.Arrays.asList; import static java.util.Collections.addAll; import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; +import static org.apache.maven.surefire.booter.Classpath.emptyClasspath; +import static org.apache.maven.surefire.booter.Classpath.join; import static org.apache.maven.surefire.shared.lang3.StringUtils.substringBeforeLast; import static org.apache.maven.surefire.shared.lang3.SystemUtils.IS_OS_WINDOWS; import static org.apache.maven.plugin.surefire.SurefireDependencyResolver.isWithinVersionSpec; @@ -1388,22 +1391,27 @@ public abstract class AbstractSurefireMojo private ResolvePathResultWrapper findModuleDescriptor( File jdkHome ) { - File mainBuildPath = getMainBuildPath(); + ResolvePathResultWrapper test = findModuleDescriptor( jdkHome, getTestClassesDirectory(), false ); + return test.getResolvePathResult() == null ? findModuleDescriptor( jdkHome, getMainBuildPath(), true ) : test; + } - if ( mainBuildPath.isDirectory() && !new File( mainBuildPath, "module-info.class" ).exists() ) + private ResolvePathResultWrapper findModuleDescriptor( File jdkHome, File buildPath, boolean isMainDescriptor ) + { + if ( buildPath.isDirectory() && !new File( buildPath, "module-info.class" ).exists() ) { - return new ResolvePathResultWrapper( null, true ); + return new ResolvePathResultWrapper( null, isMainDescriptor ); } try { - ResolvePathRequest<?> request = ResolvePathRequest.ofFile( mainBuildPath ).setJdkHome( jdkHome ); + ResolvePathRequest<?> request = ResolvePathRequest.ofFile( buildPath ).setJdkHome( jdkHome ); ResolvePathResult result = getLocationManager().resolvePath( request ); - return new ResolvePathResultWrapper( result.getModuleNameSource() == null ? null : result, true ); + boolean isEmpty = result.getModuleNameSource() == null; + return new ResolvePathResultWrapper( isEmpty ? null : result, isMainDescriptor ); } catch ( Exception e ) { - return new ResolvePathResultWrapper( null, true ); + return new ResolvePathResultWrapper( null, isMainDescriptor ); } } @@ -1980,6 +1988,10 @@ public abstract class AbstractSurefireMojo @Nonnull DefaultScanResult scanResult, @Nonnull String javaHome, @Nonnull TestClassPath testClasspathWrapper ) throws IOException { + boolean isMainDescriptor = moduleDescriptor.isMainModuleDescriptor(); + JavaModuleDescriptor javaModuleDescriptor = moduleDescriptor.getResolvePathResult().getModuleDescriptor(); + SortedSet<String> packages = new TreeSet<>(); + Classpath testClasspath = testClasspathWrapper.toClasspath(); Classpath providerClasspath = classpathCache.getCachedClassPath( providerName ); @@ -1988,32 +2000,54 @@ public abstract class AbstractSurefireMojo providerClasspath = classpathCache.setCachedClasspath( providerName, providerArtifacts ); } - ResolvePathsRequest<String> req = ResolvePathsRequest.ofStrings( testClasspath.getClassPath() ) - .setJdkHome( javaHome ) - .setModuleDescriptor( moduleDescriptor.getResolvePathResult().getModuleDescriptor() ); - - ResolvePathsResult<String> result = getLocationManager().resolvePaths( req ); - for ( Entry<String, Exception> entry : result.getPathExceptions().entrySet() ) + Classpath testModulepath; + if ( isMainDescriptor ) { - // Probably JDK version < 9. Other known causes: passing a non-jar or a corrupted jar. - getConsoleLogger() - .warning( "Exception for '" + entry.getKey() + "'.", entry.getValue() ); - } + ResolvePathsRequest<String> req = ResolvePathsRequest.ofStrings( testClasspath.getClassPath() ) + .setJdkHome( javaHome ) + .setModuleDescriptor( javaModuleDescriptor ); - testClasspath = new Classpath( result.getClasspathElements() ); - Classpath testModulepath = new Classpath( result.getModulepathElements().keySet() ); + ResolvePathsResult<String> result = getLocationManager().resolvePaths( req ); + for ( Entry<String, Exception> entry : result.getPathExceptions().entrySet() ) + { + // Probably JDK version < 9. Other known causes: passing a non-jar or a corrupted jar. + getConsoleLogger() + .warning( "Exception for '" + entry.getKey() + "'.", entry.getValue() ); + } - SortedSet<String> packages = new TreeSet<>(); + testClasspath = new Classpath( result.getClasspathElements() ); + testModulepath = new Classpath( result.getModulepathElements().keySet() ); - for ( String className : scanResult.getClasses() ) + for ( String className : scanResult.getClasses() ) + { + packages.add( substringBeforeLast( className, "." ) ); + } + } + else { - packages.add( substringBeforeLast( className, "." ) ); + testModulepath = testClasspath; + testClasspath = emptyClasspath(); + + ResolvePathsRequest<String> req = ResolvePathsRequest.ofStrings( providerClasspath.getClassPath() ) + .setJdkHome( javaHome ) + .setModuleDescriptor( javaModuleDescriptor ); + + ResolvePathsResult<String> result = getLocationManager().resolvePaths( req ); + for ( Entry<String, Exception> entry : result.getPathExceptions().entrySet() ) + { + // Probably JDK version < 9. Other known causes: passing a non-jar or a corrupted jar. + getConsoleLogger() + .warning( "Exception for '" + entry.getKey() + "'.", entry.getValue() ); + } + + providerClasspath = new Classpath( result.getClasspathElements() ); + testModulepath = join( testModulepath, new Classpath( result.getModulepathElements().keySet() ) ); } - getConsoleLogger().debug( "main module descriptor name: " + result.getMainModuleDescriptor().name() ); + getConsoleLogger().debug( "main module descriptor name: " + javaModuleDescriptor.name() ); - ModularClasspath modularClasspath = new ModularClasspath( result.getMainModuleDescriptor().name(), - testModulepath.getClassPath(), packages, getTestClassesDirectory() ); + ModularClasspath modularClasspath = new ModularClasspath( javaModuleDescriptor.name(), + testModulepath.getClassPath(), packages, getTestClassesDirectory(), isMainDescriptor ); Artifact[] additionalInProcArtifacts = { getCommonArtifact(), getBooterArtifact(), getExtensionsArtifact(), getApiArtifact(), getSpiArtifact(), getLoggerApiArtifact(), getSurefireSharedUtilsArtifact() }; 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 5336ac6..7b0c175 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 @@ -181,7 +181,7 @@ public abstract class DefaultForkConfiguration Classpath bootClasspath = getBooterClasspath(); Classpath testClasspath = pathConfig.getTestClasspath(); Classpath providerClasspath = pathConfig.getProviderClasspath(); - Classpath completeClasspath = join( join( bootClasspath, testClasspath ), providerClasspath ); + Classpath completeClasspath = mergeClasspath( pathConfig, bootClasspath, testClasspath, providerClasspath ); getLogger().debug( completeClasspath.getLogMessage( "boot classpath:" ) ); getLogger().debug( completeClasspath.getCompactLogMessage( "boot(compact) classpath:" ) ); @@ -190,6 +190,13 @@ public abstract class DefaultForkConfiguration } @Nonnull + protected Classpath mergeClasspath( AbstractPathConfiguration pathConfig, + Classpath bootClasspath, Classpath testClasspath, Classpath providerClasspath ) + { + return join( join( bootClasspath, testClasspath ), providerClasspath ); + } + + @Nonnull private File getWorkingDirectory( int forkNumber ) throws SurefireBooterForkException { diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java index a8ca9ac..22cd0cf 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java @@ -36,6 +36,7 @@ import javax.annotation.Nullable; import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -45,6 +46,7 @@ import java.util.Properties; import static java.io.File.createTempFile; import static java.io.File.pathSeparatorChar; import static org.apache.maven.plugin.surefire.SurefireHelper.escapeToPlatformPath; +import static org.apache.maven.surefire.booter.Classpath.emptyClasspath; import static org.apache.maven.surefire.shared.utils.StringUtils.replace; import static org.apache.maven.surefire.api.util.internal.StringUtils.NL; @@ -95,14 +97,32 @@ public class ModularClasspathForkConfiguration ModularClasspath modularClasspath = modularClasspathConfiguration.getModularClasspath(); + boolean isMainDescriptor = modularClasspath.isMainDescriptor(); String moduleName = modularClasspath.getModuleNameFromDescriptor(); - List<String> modulePath = modularClasspath.getModulePath(); + List<String> modulePath = new ArrayList<>( modularClasspath.getModulePath() ); Collection<String> packages = modularClasspath.getPackages(); File patchFile = modularClasspath.getPatchFile(); - List<String> classpath = toCompleteClasspath( config ); + + List<String> classpath = new ArrayList<>( toCompleteClasspath( config ) ); + /*String name = null; + for ( Iterator<String> it = classpath.iterator(); it.hasNext(); ) + { + name = it.next(); + if ( name.endsWith( "surefire-booter-3.0.0-SNAPSHOT.jar" ) ) + { + it.remove(); + break; + } + } + + modulePath.add( name );*/ + modulePath.addAll( classpath ); + classpath.clear(); File argsFile = createArgsFile( moduleName, modulePath, classpath, packages, patchFile, startClass ); + cli.createArg().setValue( "--show-module-resolution" ); + cli.createArg().setValue( "@" + escapeToPlatformPath( argsFile.getAbsolutePath() ) ); } catch ( IOException e ) @@ -115,6 +135,20 @@ public class ModularClasspathForkConfiguration } @Nonnull + @Override + protected Classpath mergeClasspath( AbstractPathConfiguration pathConfig, + Classpath bootClasspath, Classpath testClasspath, Classpath providerClasspath ) + { + boolean isMainDescriptor = + pathConfig.toRealPath( ModularClasspathConfiguration.class ) + .getModularClasspath() + .isMainDescriptor(); + + return super.mergeClasspath( pathConfig, + bootClasspath, isMainDescriptor ? testClasspath : emptyClasspath(), providerClasspath ); + } + + @Nonnull File createArgsFile( @Nonnull String moduleName, @Nonnull List<String> modulePath, @Nonnull List<String> classPath, @Nonnull Collection<String> packages, @Nonnull File patchFile, @Nonnull String startClassName ) @@ -208,7 +242,7 @@ public class ModularClasspathForkConfiguration .append( NL ); } - args.append( startClassName ); + args.append( "--module org.apache.maven.surefire.booter/" ).append( startClassName ); String argsFileContent = args.toString(); 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 0440816..f747091 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 @@ -165,6 +165,8 @@ public class AbstractSurefireMojoTest { AbstractSurefireMojo mojo = spy( new Mojo() ); mojo.setMainBuildPath( tempFolder.newFolder() ); + File testClassesDir = tempFolder.newFolder(); + mojo.setTestClassesDirectory( testClassesDir ); File jdkHome = new File( System.getProperty( "java.home" ) ); ResolvePathResultWrapper wrapper = invokeMethod( mojo, "findModuleDescriptor", jdkHome ); @@ -200,6 +202,8 @@ public class AbstractSurefireMojoTest .when( mojo, "getLocationManager" ); File classesDir = tempFolder.newFolder(); mojo.setMainBuildPath( classesDir ); + File testClassesDir = tempFolder.newFolder(); + mojo.setTestClassesDirectory( testClassesDir ); File descriptorFile = new File( classesDir, "module-info.class" ); assertThat( descriptorFile.createNewFile() ).isTrue(); File jdkHome = new File( System.getProperty( "java.home" ) ); @@ -255,6 +259,8 @@ public class AbstractSurefireMojoTest .when( mojo, "getLocationManager" ); File classesDir = tempFolder.newFolder(); mojo.setMainBuildPath( classesDir ); + File testClassesDir = tempFolder.newFolder(); + mojo.setTestClassesDirectory( testClassesDir ); File descriptorFile = new File( classesDir, "module-info.class" ); assertThat( descriptorFile.createNewFile() ).isTrue(); @@ -661,9 +667,6 @@ public class AbstractSurefireMojoTest when( resolvePathsResult.getPathExceptions() ).thenReturn( emptyMap() ); when( resolvePathsResult.getClasspathElements() ).thenReturn( emptyList() ); when( resolvePathsResult.getModulepathElements() ).thenReturn( emptyMap() ); - JavaModuleDescriptor desc = mock( JavaModuleDescriptor.class ); - when( desc.name() ).thenReturn( "" ); - when( resolvePathsResult.getMainModuleDescriptor() ).thenReturn( desc ); mojo.setLogger( mock( Logger.class ) ); mojo.setUseModulePath( true ); @@ -703,6 +706,9 @@ public class AbstractSurefireMojoTest mojo.setPluginArtifactMap( artifacts ); ResolvePathResult resolvePathResult = mock( ResolvePathResult.class ); + JavaModuleDescriptor desc = mock( JavaModuleDescriptor.class ); + when( desc.name() ).thenReturn( "" ); + when( resolvePathResult.getModuleDescriptor() ).thenReturn( desc ); ResolvePathResultWrapper wrapper = new ResolvePathResultWrapper( resolvePathResult, true ); // ### END @@ -2013,6 +2019,7 @@ public class AbstractSurefireMojoTest extends AbstractSurefireMojo implements SurefireReportParameters { private File mainBuildPath; + private File testClassesDirectory; private boolean useModulePath; private JUnitPlatformProviderInfo createJUnitPlatformProviderInfo( Artifact junitPlatformArtifact, @@ -2102,13 +2109,13 @@ public class AbstractSurefireMojoTest @Override public File getTestClassesDirectory() { - return null; + return testClassesDirectory; } @Override public void setTestClassesDirectory( File testClassesDirectory ) { - + this.testClassesDirectory = testClassesDirectory; } @Override 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 af317c2..46b5d23 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 @@ -136,7 +136,7 @@ public class ModularClasspathForkConfigurationTest assertThat( argsFileLines.get( 12 ) ) .isEqualTo( ForkedBooter.class.getName() ); - ModularClasspath modularClasspath = new ModularClasspath( "abc", modulePath, packages, patchFile ); + ModularClasspath modularClasspath = new ModularClasspath( "abc", modulePath, packages, patchFile, true ); Classpath testClasspathUrls = new Classpath( singleton( "target" + separator + "test-classes" ) ); Classpath surefireClasspathUrls = Classpath.emptyClasspath(); ModularClasspathConfiguration modularClasspathConfiguration = diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml index c7129c7..c9c3143 100644 --- a/surefire-booter/pom.xml +++ b/surefire-booter/pom.xml @@ -134,6 +134,17 @@ </systemPropertyVariables> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestEntries> + <Automatic-Module-Name>org.apache.maven.surefire.booter</Automatic-Module-Name> + </manifestEntries> + </archive> + </configuration> + </plugin> </plugins> </build> </project> diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java index d8e3bfe..5abcc4e 100644 --- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java +++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java @@ -478,7 +478,14 @@ public final class ForkedBooter bpf.setTestRequest( providerConfiguration.getTestSuiteDefinition() ); bpf.setReporterConfiguration( providerConfiguration.getReporterConfiguration() ); bpf.setForkedChannelEncoder( eventChannel ); - ClassLoader classLoader = currentThread().getContextClassLoader(); + ClassLoader classLoader = SystemUtils.platformClassLoader(); + if ( classLoader == null ) + { + classLoader = currentThread().getContextClassLoader(); + } + System.out.println( "CL - " + classLoader ); + // ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + // ClassLoader classLoader = currentThread().getContextClassLoader(); bpf.setClassLoaders( classLoader ); bpf.setTestArtifactInfo( providerConfiguration.getTestArtifact() ); bpf.setProviderProperties( providerConfiguration.getProviderProperties() ); @@ -563,8 +570,8 @@ public final class ForkedBooter } catch ( Throwable t ) { - DumpErrorSingleton.getSingleton().dumpException( t ); t.printStackTrace(); + DumpErrorSingleton.getSingleton().dumpException( t ); if ( booter.eventChannel != null ) { StackTraceWriter stack = new LegacyPojoStackTraceWriter( "test subsystem", "no method", t ); diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java index 7bf8bd0..7dcf0db 100644 --- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java +++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java @@ -39,15 +39,19 @@ public final class ModularClasspath private final List<String> modulePath; private final Collection<String> packages; private final File patchFile; + private final boolean isMainDescriptor; - public ModularClasspath( @Nonnull String moduleNameFromDescriptor, @Nonnull List<String> modulePath, + public ModularClasspath( @Nonnull String moduleNameFromDescriptor, + @Nonnull List<String> modulePath, @Nonnull Collection<String> packages, - @Nonnull File patchFile ) + @Nonnull File patchFile, + boolean isMainDescriptor ) { this.moduleNameFromDescriptor = moduleNameFromDescriptor; this.modulePath = modulePath; this.packages = packages; this.patchFile = patchFile; + this.isMainDescriptor = isMainDescriptor; } @Nonnull @@ -73,4 +77,9 @@ public final class ModularClasspath { return patchFile; } + + public boolean isMainDescriptor() + { + return isMainDescriptor; + } } diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml index 42e3ec5..3542f5b 100644 --- a/surefire-its/pom.xml +++ b/surefire-its/pom.xml @@ -175,7 +175,7 @@ <forkMode>once</forkMode> <argLine>-server -Xmx64m -XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Djava.awt.headless=true -Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine> <includes> - <include>org/apache/**/*IT*.java</include> + <include>org/apache/**/MultiModuleProjectWithJPMSIT.java</include> </includes> <!-- Pass current surefire version to the main suite so that it --> <!-- can forward to all integration test projects. SUREFIRE-513 --> diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/pom.xml b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/pom.xml index e151aff..d435712 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/pom.xml +++ b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/pom.xml @@ -42,7 +42,13 @@ </dependency> <dependency> <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> + <artifactId>junit-jupiter-engine</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + <version>1.6.2</version> <scope>test</scope> </dependency> </dependencies> diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/main/java/module-info.java b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/main/java/module-info.java index af383c6..13ca174 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/main/java/module-info.java +++ b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/main/java/module-info.java @@ -19,8 +19,8 @@ module com.foo.impl { + exports com.foo.impl; + requires com.foo.api; requires org.slf4j; requires org.slf4j.simple; - opens com.foo.impl; - requires com.foo.api; } diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/impl/BarIT.java b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/implt/BarIT.java similarity index 96% rename from surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/impl/BarIT.java rename to surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/implt/BarIT.java index 43596b7..acb4c7f 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/impl/BarIT.java +++ b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/implt/BarIT.java @@ -1,4 +1,4 @@ -package com.foo.impl; +package com.foo.implt; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,6 +19,8 @@ package com.foo.impl; * under the License. */ +import com.foo.impl.Bar; + import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/impl/BarTest.java b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/implt/BarTest.java similarity index 96% rename from surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/impl/BarTest.java rename to surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/implt/BarTest.java index 6e392b6..f639198 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/impl/BarTest.java +++ b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/com/foo/implt/BarTest.java @@ -1,4 +1,4 @@ -package com.foo.impl; +package com.foo.implt; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,6 +19,8 @@ package com.foo.impl; * under the License. */ +import com.foo.impl.Bar; + import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/main/java/module-info.java b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java similarity index 63% copy from surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/main/java/module-info.java copy to surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java index af383c6..4374332 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/main/java/module-info.java +++ b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/com.foo.impl/src/test/java/module-info.java @@ -17,10 +17,20 @@ * under the License. */ -module com.foo.impl +module com.foo.test { + requires transitive com.foo.impl; + requires transitive com.foo.api; requires org.slf4j; requires org.slf4j.simple; - opens com.foo.impl; - requires com.foo.api; + requires java.persistence; + requires java.ws.rs; + requires java.xml.bind; + requires jakarta.activation; + requires transitive org.junit.platform.launcher; + requires transitive org.junit.jupiter.engine; + requires transitive org.junit.jupiter.api; + requires transitive org.apiguardian.api; + requires transitive org.junit.platform.commons; + requires transitive org.opentest4j; } diff --git a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/pom.xml b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/pom.xml index 0f6bc9a..00e047f 100644 --- a/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/pom.xml +++ b/surefire-its/src/test/resources/maven-multimodule-project-with-jpms/pom.xml @@ -66,7 +66,7 @@ </dependency> <dependency> <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> + <artifactId>junit-jupiter-engine</artifactId> <version>5.6.2</version> </dependency> </dependencies>