diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe29d51dafc..586a04b6bf9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,6 +73,8 @@ jobs: uses: actions/setup-java@v1 with: java-version: ${{ matrix.os.java.version }} + - name: Log branches + run: git branch -a # https://github.com/actions/cache/blob/main/examples.md#java---maven - name: Cache local Maven repository uses: actions/cache@v3 @@ -88,9 +90,9 @@ jobs: - name: Building code and running unit tests and basic checks run: ./mvnw $MAVEN_ARGS install -Pjqassistant -Pdist -Pci-sources-check -DskipITs - name: Running integration tests in the default environment - run: | - ./mvnw $MAVEN_ARGS verify \ - -DskipSurefireTests -Pskip-checks -Pci-rebuild \ + run: > + ./mvnw $MAVEN_ARGS verify + -DskipSurefireTests -Pskip-checks -Pci-rebuild ${{ github.event.pull_request.base.ref && format('-Dincremental -Dgib.referenceBranch=refs/remotes/origin/{0}', github.event.pull_request.base.ref) || '' }} - name: Docker cleanup if: always() diff --git a/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java b/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java index 83cd3bf43f2..7248804d362 100644 --- a/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java +++ b/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java @@ -150,7 +150,7 @@ else if ( "file".equals( codeSourceLocation.getProtocol() ) ) { else { // The URI points to a regular file, so hopefully an actual JAR file. // We'll try to open a ZIP filesystem to work on the contents of the JAR file. - URI jarUri = new URI( "jar:file", null, path.toString(), null ); + URI jarUri = new URI( "jar:file", null, path.toUri().getPath(), null ); tryInitJarFileSystem( jarUri ); } } diff --git a/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java b/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java index 5b8b6714f98..e4fcc766601 100644 --- a/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java +++ b/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java @@ -51,13 +51,14 @@ public void directory() throws Exception { addSimpleClass( root ); } ); - try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( dirPath.toUri().toURL() ) ) { + URL dirPathUrl = dirPath.toUri().toURL(); + try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( dirPathUrl ) ) { Class classInIsolatedClassLoader = isolatedClassLoader.loadClass( SimpleClass.class.getName() ); // Check preconditions: this is the situation that we want to test. URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation(); assertThat( location.getProtocol() ).isEqualTo( "file" ); - assertThat( location.toExternalForm() ).contains( dirPath.toString() ); + assertThat( location.toExternalForm() ).contains( dirPathUrl.toString() ); // Check that the JAR can be opened and that we can access other files within it try ( CodeSource codeSource = new CodeSource( location ) ) { @@ -86,13 +87,14 @@ public void jar_fileScheme() throws Exception { addSimpleClass( root ); } ); - try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( jarPath.toUri().toURL() ) ) { + URL jarPathUrl = jarPath.toUri().toURL(); + try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( jarPathUrl ) ) { Class classInIsolatedClassLoader = isolatedClassLoader.loadClass( SimpleClass.class.getName() ); // Check preconditions: this is the situation that we want to test. URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation(); assertThat( location.getProtocol() ).isEqualTo( "file" ); - assertThat( location.toExternalForm() ).contains( jarPath.toString() ); + assertThat( location.toExternalForm() ).contains( jarPathUrl.toString() ); // Check that the JAR can be opened and that we can access other files within it try ( CodeSource codeSource = new CodeSource( location ) ) { @@ -130,7 +132,7 @@ public void jar_jarScheme_classesInRoot() throws Exception { URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation(); // For some reason the "jar" scheme gets replaced with "file" assertThat( location.getProtocol() ).isEqualTo( "file" ); - assertThat( location.toExternalForm() ).contains( jarPath.toString() ); + assertThat( location.toExternalForm() ).contains( jarPath.toUri().toURL().toString() ); // Check that the JAR can be opened and that we can access other files within it try ( CodeSource codeSource = new CodeSource( location ) ) {