0

I'm trying to run a Gradle project with Ansible on a Linux server. If I go into the server and manually enter './gradlew clean deploy' I get no issues.

When I run it with Ansible, I'm getting a 'Can not find tools.jar' error. I have set my JAVA_HOME properly, because I used to get this error when entering manually.

I double checked my $JAVA_HOME, I confirmed that the directory was correct, I tried to do a shell using '&&' to cd into the dir and then run the command.

 - name: go to directory and deploy
   shell: ./gradlew clean deploy
   args:
     chdir: /DIR/I_NEED/TO_RUN_IN/
ChrisP
  • 125
  • 1
  • 14
  • 2
    Variables like JAVA_HOME are per process, and not per user or system. You need to make sure it's set correctly in Ansible, not just in your interactive shells – that other guy Jun 17 '19 at 19:29
  • So I just need to do exportJAVA_HOME=blablahjdk1.8 before I run my other commands? I'm running this via Ansible Tower. – ChrisP Jun 17 '19 at 19:33
  • 1
    `export` is only for shells. See the duplicate for how to define environment variables in Ansible – that other guy Jun 17 '19 at 19:37

0 Answers0