Allow for PU jar-file entries as relative file paths (intended for testing)

This commit is contained in:
Steve Ebersole 2021-09-02 14:02:46 -05:00
parent dd6efa509b
commit 60e97bcfca
2 changed files with 7 additions and 1 deletions

View File

@ -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')

View File

@ -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 ) );