hi,
I have this line (java pom.xml):
${gatk.shell.directory}/check_utils_engine_tools.sh
maven executes this as a bash script during build phase.
It gives the following error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
(check-utils-engine-tools) on project gatk-aggregator:
Command execution failed.: Cannot run program
"/build/source/public/src/main/scripts/shell/check_utils_engine_tools.sh"
(in directory "/build/source"): error=2, No such file or directory -> [Help 1]
the path /build/source
is sandboxed right?
I think I could put the relative path into that value. I tried escaping $ with ‘’, but it gives me bad substitution
error :
substituteInPlace pom.xml \
--replace "''${gatk.shell.directory}/check_utils_engine_tools.sh" "./public/src/main/scripts/shell/check_utils_engine_tools.sh"
any way to do this?
You’re using ''$
to escape the shell variable, except that’s only the escape inside of a ''multiline string''
. In a "double-quoted string"
you just escape with \
instead.
Thank you very much @lilyball
however I still get gatk
as an undefined variable when I do this:
substituteInPlace pom.xml \
--replace "\${gatk.shell.directory}/check_utils_engine_tools.sh" "..."
I think I’ll just go with creating a patch using git
instead. At least I get to test that out as well
I’ve put a gist up, if anyone wants to test it out:
Oh I know what happened. substituteInPlace
is a shell function so I assume you actually had something like
postPatch = ''
substituteInPlace pom.xml \
--replace "\${gatk.shell.directory}/check_utils_engine_tools.sh" "..."
''
This means you need to worry about both Nix and Bash variable escaping. This can be handled by using your original ''$
escape but adding the \
for bash, as in
postPatch = ''
substituteInPlace pom.xml \
--replace "\''${gatk.shell.directory}/check_utils_engine_tools.sh" "..."
''
Alternatively you could change the "
to '
but I’m not sure offhand how to do that given the ''$
immediately following.
Thanks again @lilyball
I tried this too, seems that it also escapes the replace
script (it’s not able to see the pattern). I did fix it with a git diff patch. Needed to do some other changes as well, so think it’s the best way in anyway.
Thanks a lot for the help though!! I think the substituteInPlace
function is very convenient.