Shorten classpath (-cp) for command line

If you are using Windows 10 Anniversary Update or Windows Server 2016, or later, you can increase the maximum path length beyond the 260 character default.

You can either copy the following two lines into a file with a .reg extension and open it,

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

Or, open the Registry Editor and browse to the location, and change the value from 0 to 1.


The maven-jdeps-plugin is using plexus-utils to fork out a child process to run the jdeps executable. plexus-utils implements this by building up a command-line and passing it to cmd.exe. This is the wrong approach as it will be subject to the 8192 char limit imposed by cmd.exe. The correct approach would be to use the Java ProcessBuilder API. This itself uses ProcessImpl.create API method, which, on Windows, is implemented by a Win32 API call to CreateProcess. The latter API has a 32k char limit, which should be enough for most use cases.

There is a plexus-utils bug report for this. You may want to raise one with maven-jdeps-plugin as well - the Java ProcessBuilder API is quite usable, so there's no need to use plexus-utils just to run jdeps.