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

This comment has been minimized.

Copy link

edarchis commented Jul 22, 2015

Thanks for the tip, exactly what I needed.

@artem-zinnatullin

This comment has been minimized.

Copy link
Owner Author

artem-zinnatullin commented Jul 22, 2015

@edarchis you are welcome!

@emartynov

This comment has been minimized.

Copy link

emartynov commented Jul 23, 2015

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

Thank you!

@mttkay

This comment has been minimized.

Copy link

mttkay commented Jul 27, 2015

❤️

This was annoying the heck out of me. Thanks!

@artem-zinnatullin

This comment has been minimized.

Copy link
Owner Author

artem-zinnatullin commented Jul 29, 2015

@mttkay @emartynov #DevelopersWantComfort #DevelopersGetComfort

@hamen

This comment has been minimized.

Copy link

hamen commented Aug 6, 2015

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

@hamen

This comment has been minimized.

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

@artem-zinnatullin

This comment has been minimized.

Copy link
Owner Author

artem-zinnatullin commented Jun 13, 2016

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

@edenman

This comment has been minimized.

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'

@artem-zinnatullin

This comment has been minimized.

Copy link
Owner Author

artem-zinnatullin commented Aug 8, 2016

Uh, same for me, thanks for receipt @edenman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.