How can I add backticks ''' into a gradle script to generate a sh script with jvm args?

How can I add backticks ‘’’ into a gradle script?

I’m using jvm args in my build.gradle:

applicationDefaultJvmArgs = [‘-Dlogback.configurationFile=file:…/logback.xml’,-Dcom.sun.management.jmxremote.port=8368,-Dcom.sun.management.jmxremote.ssl=false,-Dcom.sun.management.jmxremote.authenticate=false,-Djava.rmi.server.hostname=‘hostname’]

When I run gradle, it reports this error:

startup failed:

build file ‘/home/kruthan/src/enrich/build.gradle’: 102: unexpected char: ‘’’ @ line 102, column 239.

se,-Djava.rmi.server.hostname=‘hostname’

^ as it can’t handle the backtick around hostname. I’ve tried ' but it didn’t help.

Backticks are a part of the shell syntax, so they won’t work in gradle or any environment other than a shell. You can get the hostname using InetAddress.getLocalHost().getHostName().