I try to compile a java project with multiple .java files that are in multiple directories. The only flag that I think will help me is the @filename where filename stands for a file with all .java paths.
The PowerShell command that I run is:
javac @sources.txt
And this is the error:
The splatting operator '@' cannot be used to reference variables in an expression. '@sources' can be used only as an argument to a command. To reference variables in an expression use '$sources'.
I mention that I tested this command with cmd and the result is the same.
It is important to compile the java project using powershell, not ant. I am also pleased with a solution that would compile all my .java files without using this option from javac.
What I want to do further is to create a jar file. In order to do this I have to compile the java files.
cd $basedir
cmd /r dir "*.java" /s /B > sources.txt
javac "@sources.txt"
That is what I do and the sources.txt file is fine.