Ok, so I had this problem and now I'm getting a ProviderMismatchException
I understand the problem, and "a" fix, but since my problem is specifically related to testing in Gradle, I'm wondering if there's a better fix that doesn't involve change my "production" code.
just as an FYI, this is my code currently that lives in as part of the testFixture
default Path getConfigDir() {
return Try.ofSupplier( this::getClass )
.map( Class::getClassLoader )
.mapTry( cl -> cl.getResource( "config" ) )
.filter( Objects::nonNull, t -> new IOException( "unable to find resource 'config'" ) )
.mapTry( URL::toURI )
.peek( uri -> LogManager.getLogger().error( "{}", uri ) )
.mapTry( uri -> FileSystems.newFileSystem(uri, Map.of()).getPath("." ) )
.get();
}
all that's relevant for gradle.
plugins {
application
`java-test-fixtures`
checkstyle
distribution
later it does this
var filename = moduleType + ".yml";
var relPathToConfigFIle = Path.of( language ).resolve( filename );
var cwdConfigFile = configDir.resolve( relPathToConfigFIle ); // exception
var home = SystemUtils.getUserHome().toPath();
seems to be failing on the commons-lang3
call to getUserHome()
currently.
I'm thinking maybe there's some way for Gradle not to use the jar?