No not this one
var cwd = Path.of( "" );
log.info( "user.dir: {}", Path.of( System.getProperty( "user.dir" ) ) );
log.info( "cwd: {}", cwd.toAbsolutePath() );
log.info( "PWD: {}", System.getenv( "PWD" ) );
❯ ./modules/app/build/libs/brix-0.1.0.jar --logging.level.com.xenoterracide.brix=info java module foo # brix -> ccushing/release !
INFO - Starting Application using Java 11.0.11 on CarbonX1-8-Manjaro with PID 51641 (/home/xeno/IdeaProjects/brix/modules/app/build/libs/brix-0.1.0.jar started by xeno in /home/xeno/IdeaProjects/brix/modules/app/build/libs) - com.xenoterracide.brix.Application
INFO - No active profile set, falling back to default profiles: default - com.xenoterracide.brix.Application
INFO - Started Application in 0.843 seconds (JVM running for 1.633) - com.xenoterracide.brix.Application
INFO - user.dir: /home/xeno/IdeaProjects/brix/modules/app/build/libs - com.xenoterracide.brix.configloader.service.ConfigValueProcessor
INFO - cwd: /home/xeno/IdeaProjects/brix/modules/app/build/libs - com.xenoterracide.brix.configloader.service.ConfigValueProcessor
INFO - PWD: /home/xeno/IdeaProjects/brix/modules/app/build/libs - com.xenoterracide.brix.configloader.service.ConfigValueProcessor
Overwrite [yN] module/src/test/java/com/xenoterracide/TestApplication.java
❯ pwd # brix -> ccushing/release !
/home/xeno/IdeaProjects/brix ####!!!!! THIS ONE
^ that last one, in a cross platform compatible way.
I'm using a Spring Boot jar launch script.
tasks.withType<BootJar> {
mainClass.set("com.xenoterracide.brix.Application")
archiveBaseName.set("brix")
launchScript {
properties(
mapOf(
"spring.config.location" to "classpath:application.properties"
)
)
}
}
how can I get the real working directory?