JDK-8154398 : Support nested argument files
  • Type: Enhancement
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-04-18
  • Updated: 2016-06-23
  • Resolved: 2016-06-23
Related Reports
Relates :  
Description
JDK 9 now supports argument files.  
However, if I pass an argument file to a tool like Gradle and it in turn uses an argument file for my arguments and its own, then I get a nested argument file.
That fails to run.

While reading an argument file, if another argument file is found, expand it there in place.  Also, detect recursive inclusions and don't process any file already processed without an error.

Comments
Nested argument files are highly problematic. The possibility of recursive nesting, in particular, could lead to scenarios that are very difficult to debug. We could try to detect that and prevent it automatically, at the cost of additional complexity, but that doesn't seem worth it for such a narrow use case. Architecturally, a better way to solve the problem that motivated this request is to enhance Gradle to support multiple, side-by-side argument files rather than have the JDK implement nesting.
23-06-2016

Clearly in this use case, multiple argument files is not the solution. Gradle puts my argument file nested inside their argument file and it fails. Since the Gradle argument file is created on-the-fly, the error message is confusing at best.
01-06-2016

I think the scenario will need further analysis to see whether whether nesting scenarios actually will arise. It may be that using multiple argfiles will work, it may be that the scenario is actually a mix of VM options file and java argfile.
01-06-2016

java launcher supports multiple @argfile e.g. java @argfile1 @argfile2. Tools can append @argfile to the java launcher command-line options as an alternative.
01-06-2016