Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
// You can place it in the root build.gradle
allprojects {
tasks.withType(JavaForkOptions) {
// Forked processes like GradleWorkerMain for tests won't steal focus!
jvmArgs '-Djava.awt.headless=true'
}
}
@edarchis
Copy link

edarchis commented Jul 22, 2015

Thanks for the tip, exactly what I needed.

Loading

@artem-zinnatullin
Copy link
Author

artem-zinnatullin commented Jul 22, 2015

@edarchis you are welcome!

Loading

@emartynov
Copy link

emartynov commented Jul 23, 2015

Amazing! Added this flag also to android studio tests run configuration.

Thank you!

Loading

@mttkay
Copy link

mttkay commented Jul 27, 2015

❤️

This was annoying the heck out of me. Thanks!

Loading

@artem-zinnatullin
Copy link
Author

artem-zinnatullin commented Jul 29, 2015

@mttkay @emartynov #DevelopersWantComfort #DevelopersGetComfort

Loading

@hamen
Copy link

hamen commented Aug 6, 2015

👍 thank you so much! Finally, I can use ./gradlew test -t without losing my sanity!

Loading

@hamen
Copy link

hamen commented Mar 2, 2016

Only way to make it work with tests, right now, is adding it to the Run configuration:
screen shot 2016-03-02 at 7 47 08 pm

This helped to avoid the window to popup when running ./gradlew:
http://stackoverflow.com/a/13849939/108742

Loading

@artem-zinnatullin
Copy link
Author

artem-zinnatullin commented Jun 13, 2016

Another Mac OS specific flag -Dapple.awt.UIElement=true

Loading

@edenman
Copy link

edenman commented Jun 28, 2016

for whatever reason, the jvmArgs thing stopped working for me recently. I had to add this to my .bashrc: export JAVA_TOOL_OPTIONS='-Djava.awt.headless=true'

Loading

@artem-zinnatullin
Copy link
Author

artem-zinnatullin commented Aug 8, 2016

Uh, same for me, thanks for receipt @edenman

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment