Prevent test app from appearing in Mac OS X dock


During a local ant build of Clojure (tested with master after release of 1.6.0-beta1), the script/run_test.clj is executed. As a side-effect on the Mac, the Java coffee cup app icon is placed in the Dock, and the test app becomes the active application on the desktop. This is slightly annoying.

Even with this property set, activation of awt causes focus to switch temporarily then switch back (at least on Mac).

Solution: Set the following properties during the build:

Patch: clj-1353-v4.patch


Mac OS X


Alex Miller
February 25, 2014, 5:33 PM

Added v4 patch that only sets java.awt.headless=true and drops the apple property.

Steve Miner
February 24, 2014, 9:28 PM

Yes, it seems that java.awt.headless=true is a better, more general solution for the build process. I think apple.awt.UIElement would be appropriate if you actually needed AWT for user interaction but didn't want the dock icon.

Andy Fingerhut
February 24, 2014, 8:35 PM

In my testing, the addition of the java.awt.headless=true properties in both build.xml and src/script/run_tests.clj was sufficient to avoid the additional icon appearing, and also avoiding any change of focus. Setting apple.awt.UIElement=true appears to be unnecessary (but harmless).

Alex Miller
February 18, 2014, 7:42 PM

I found that even with this property, I still see focus change, then come back, during the build due to the activation of awt. Adding the java.awt.headless=true property made that stop. I updated the patch in both locations and now on Mac focus is never stolen during the build.

FYI: If you see the Java "Allow incoming network connections?" dialog on Mac during the tests in response to creating the Sockets in test/clojure/test_clojure/java/io.clj (test-socket-iofactory), this procedure makes that stop:

Beware tracking down the correct version of Java (for example the 1.6 version) instead of the easier to find 1.7 version - the permissions are separate for each version.

Steve Miner
February 17, 2014, 7:45 PM

Adding the sysproperty setting to build.xml sounds like a good idea. Thanks.





Steve Miner







Fix versions

Affects versions