I recently had some issues with gradle ignoring some environment variables under Linux.
I was trying to retrieve those variables with a
System.getenv but the output I got, especially for the $CLASSPATH, were completly different.
I finally found out that in the bin/gradle there was the following assignation
CLASSPATH=$APP_HOME/lib/gradle-launcher-5.6.2.jar. Obviously, the fix is to use this one instead
CLASSPATH=$CLASSPATH:$APP_HOME/lib/gradle-launcher-5.6.2.jar to keep what is already in the classpath.
Is there a reason why gradle is erasing the variable instead of just adding what it needs in it? And if yes, what are the other options for the user to use the classpath? I use CLASSPATH to share its same value for different things and I don’t want to duplicate it.