Maven and User folder Bash_profile

Craig_Whittaker
New Contributor III

Good Morning All

I am wanting to deploy maven to group of machines and set the following

~/.bash_profile
export M2_HOME=/Users/Shared/apache-maven-3.5.0
export PATH=$PATH:$M2_HOME/bin

is this possible to set under the users path I.e /Users/Staff.Name/.bash_profile

I have had a go at copying this file with the maven package and then running an after script to move it to ~/, but I suspect this always runs as root and then moves this to root ~/ not the logged in user ~/

1 REPLY 1

geoffrepoli
Contributor

If the intent is to add this for all users, you could just add it to /etc/bashrc.

Throw this into your postinstall script:

echo $'export M2_HOME=/Users/Shared/apache-maven-3.5.0
export PATH=$PATH:$M2_HOME/bin' >> /etc/bashrc