since the upgrade to OSX Mountain Lion I‘ve got some problems with setting the environment variables for eclipse and maven.
My goal is to run a maven command in Eclipse. This command needs to download artefacts (resolve dependencies) from a remote repository. The repository is authenticated via HTTPS.
I‘ve followed the Guide to Remote repository access through authenticated HTTPS and added the lines below to my .bash_profil . If I‘m running maven in the terminal everythings works fine.
export MAVEN_OPTS="-Xmx512m -Djavax.net.ssl.trustStore=/Users/myUser/.knowncerts/trust.jks -Djavax.net.ssl.trustStorePassword=trustPwd"
But this does only work for the terminal and not for applications. On previous OSX-Versions you had to add the MAVEN_OPTS variable to
~/.MacOSX/environment.plist
(see also Set environment variables on Mac OS X Lion) This worked for OSX Lion perfectly.
But Apple has changed this behaviour on Mountain Lion. I‘ve read the environment.plist is no longer supported and the new way is to edit the Info.plist of the .app itself (Where are system environment variables set in Mountain Lion?). It seems you have to add a LSEnvironment dictionary containing all you variables.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSEnvironment</key>
<dict>
<key>M2_HOME</key>
<string>/usr/share/maven</string>
<key>MAVEN_OPTS</key>
<string>-Xmx512m -Djavax.net.ssl.trustStore=/Users/myUser/.knowncerts/trust.jks -Djavax.net.ssl.trustStorePassword=trustPwd</string>
</dict>
<key>CFBundleExecutable</key>
<string>eclipse</string>
<key>CFBundleGetInfoString</key>
<string>Eclipse 3.8 for Mac OS X, Copyright IBM Corp. and others 2002, 2011. All rights reserved.</string>
<key>CFBundleIconFile</key>
<string>Eclipse.icns</string>
<key>CFBundleIdentifier</key>
<string>org.eclipse.eclipse</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Eclipse</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.8</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleLocalizations</key>
<array>
<string>ar</string>
<string>cs</string>
<string>da</string>
<string>el</string>
<string>en</string>
<string>es</string>
<string>de</string>
<string>fi</string>
<string>fr</string>
<string>hu</string>
<string>it</string>
<string>iw</string>
<string>ja</string>
<string>ko</string>
<string>nl</string>
<string>no</string>
<string>pl</string>
<string>pt_BR</string>
<string>pt</string>
<string>ru</string>
<string>sv</string>
<string>tr</string>
<string>zh_HK</string>
<string>zh_TW</string>
<string>zh</string>
</array>
<key>Eclipse</key>
<array>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
<string>-showlocation</string>
</array>
</dict>
</plist>
As you can see I changed the Info.plist of my Eclipse.app. But this did not work. I start maven within Eclipse. But maven is not able to download the artefacts, because the remote repository is not trusted. I think Eclipse does not use the environment variables I defined in the Info.plist
Do you have any suggestions how to solve this problem?
Thanks for your answers!