diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index 403ea3d34a..6a27198d38 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -185,7 +185,7 @@ task copyBundleResources (type: Copy) { ext { bundlesTargetDir = file( "${buildDir}/bundles" ) bundleTokens = dbBundle[db] - ext.bundleTokens['buildDirName'] = buildDir.absolutePath + ext.bundleTokens['buildDirName'] = project.relativePath( buildDir ) } from file('src/test/bundles/templates') diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java index aae58e7d4d..fcbbf0cfb2 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/StandardArchiveDescriptorFactory.java @@ -106,6 +106,12 @@ public class StandardArchiveDescriptorFactory implements ArchiveDescriptorFactor return url; } else { + // see if the URL exists as a File (used for tests) + final File urlAsFile = new File( url.getFile() ); + if ( urlAsFile.exists() && urlAsFile.isFile() ) { + return url; + } + // prefer to resolve the relative URL relative to the root PU URL per // JPA 2.0 clarification. final File rootUrlFile = new File( extractLocalFilePath( rootUrl ) );