In my case it was the Maven Failsafe Plugin that caused the annoying window focus stealing of ForkedBooter, and setting the JAVA_TOOL_OPTIONS
variable in .bashrc
didn't help.
This fix applies to both Failsafe and Surefire (although in my case, Surefire wasn't stealing focus).
In your pom.xml
, add a <argLine>-Djava.awt.headless=true</argLine>
line inside the <configuration>
for the failsafe (and/or) surefire plugin.
It will look like this:
<!-- this is inside your <project><build><plugins> block -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<includes>
<include>**/unit/**/*Test*.java</include>
</includes>
<!-- prevent the annoying ForkedBooter process from stealing window
focus on Mac OS -->
<argLine>-Djava.awt.headless=true</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.failsafe.plugin.version}</version>
<configuration>
<!-- prevent the annoying ForkedBooter process from stealing window
focus on Mac OS -->
<argLine>-Djava.awt.headless=true</argLine>
<includes>
<include>**/integration/**/*Test*</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>