task runWithHostCheck(type: JavaExec) {
main = 'com.citigroup.get.quantum.server.Server'
classpath = sourceSets.main.runtimeClasspath
// Set an Environment Variable that Windows often uses for hostname resolution
environment "COMPUTERNAME", "your-custom-hostname"
// Print verification before the Java program starts
doFirst {
println "--- PRE-START HOSTNAME CHECK ---"
// This executes inside the Gradle process, but usually matches the spawned process
def localHost = java.net.InetAddress.getLocalHost()
println "Resolved Hostname: ${localHost.hostName}"
println "Resolved IP: ${localHost.hostAddress}"
println "--------------------------------"
if (localHost.hostName != "your-custom-hostname") {
println "WARNING: Hostname override not detected by InetAddress."
println "ACTION REQUIRED: Please add '127.0.0.1 your-custom-hostname' to C:\\Windows\\System32\\drivers\\etc\\hosts"
}
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)