mojohaus / maven-native

https://www.mojohaus.org/maven-native/
MIT License
18 stars 12 forks source link

Fix unit tests on Windows issue #29 #38

Closed buzz3791 closed 2 years ago

buzz3791 commented 3 years ago

Fix issue #29 "master@maven-native does not build on Windows 10 with VS2017: 8 failed tests". JUnit tests on Windows are breaking build because org.codehaus.plexus.util.cli.Commandline#getCommandline() has operating system dependent code referencing org.codehaus.plexus.util.Os.FAMILY_WINDOWS.

The fix adds a new reusuable TestUtils#formPlatformCommandline() static function that matches and encapsulates the platform behavior of Commandline#getCommandline(). For example, on windows tacks cmd.exe /X /C on the front of everything.

The new function lives in the new > maven-native-test module to allow reuse by the tests scattered across maven-native's many maven modules.

Tested on Windows 10 $ver Microsoft Windows [Version 10.0.18363.1440] and Ubuntu running on the Windows Subsystem for Linux $ uname -a Linux DPDL5CG9247TDP 4.4.0-18362-Microsoft #1049-Microsoft Thu Aug 14 12:01:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux

buzz3791 commented 2 years ago

Pull request #38 is no longer needed. #39 which added VS2019 support includes the windows unit test fix (#38) as well.