mvn clean
simply works fine from terminal. Even when I am executing the same from a bash file (.sh file) by double clicking, it working fine.
But when I trigger the same using crontab I'm getting an error mvn:command not found
bash(.sh) file have this code
#!/bin/bash
cd /Users/testautomation/Documents/Automation/TFS/Mem_Mobile
mvn clean
Output of crontab -l
0 14 * * * /Users/testautomation/Documents/Automation/Schedule/Execute.sh
Error
From testautomation@Tests-iMac.xxx.local Wed Jun 12 14:44:01 2019
Return-Path: <testautomation@Tests-iMac.xxx.local>
X-Original-To: testautomation
Delivered-To: testautomation@Tests-iMac.xxx.local
Received: by Tests-iMac.xxx.local (Postfix, from userid 501)
id 0BE233001CB411; Wed, 12 Jun 2019 14:44:00 +1000 (AEST)
From: testautomation@Tests-iMac.xxx.local (Cron Daemon)
To: testautomation@Tests-iMac.xxx.local
Subject: Cron <testautomation@Tests-iMac> /Users/testautomation/Documents/Automation/Schedule/Execute.sh
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=testautomation>
X-Cron-Env: <USER=testautomation>
X-Cron-Env: <HOME=/Users/testautomation>
Message-Id: <20190612044401.0BE233001CB411@Tests-iMac.xxx.local>
Date: Wed, 12 Jun 2019 14:44:00 +1000 (AEST)
/Users/testautomation/Documents/Automation/Schedule/Execute.sh: line 3: mvn: command not found
I have installed maven using homebrew.
mvn -version
output :
Tests-iMac:~ testautomation$ mvn -version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T06:00:29+11:00)
Maven home: /usr/local/Cellar/maven/3.6.1/libexec
Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre
Default locale: en_AU, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "Mac"