Antlr4BuildTasks icon indicating copy to clipboard operation
Antlr4BuildTasks copied to clipboard

Error with Visual Studio 17.3.1

Open Philippe-Laval opened this issue 3 years ago • 4 comments

The nuget package antlr4buildtasks 10.7.0 has a warning icon in Visual Studio. I got this error message

C:\Users\philippe.laval.nuget\packages\antlr4buildtasks\10.7.0\build\Antlr4BuildTasks.targets(133,3): error ANT02: The Antlr4 tool failed.

Philippe-Laval avatar Aug 24 '22 08:08 Philippe-Laval

I managed to solve the problem : I added JavaExec in the project and/or changed JAVA_HOME to C:\Program Files\Java\jdk-18.0.2.1

<ItemGroup>
	<Antlr4 Include="Modeler.g4">
		<Package>Modeler</Package>
		<JavaExec>c:/Program Files/Java/jdk-18.0.2.1/bin/java.exe</JavaExec>
	</Antlr4>
</ItemGroup>

<ItemGroup>
	<PackageReference Include="Antlr4.Runtime.Standard" Version="4.10.1" />
	<PackageReference Include="Antlr4BuildTasks" Version="10.7.0" />
</ItemGroup>

Philippe-Laval avatar Aug 24 '22 08:08 Philippe-Laval

Long overdue, I'm setting up a bunch of tests to methodically go through all the possible permutations of java versions, JAVA_HOME, JAVA_EXEC, PATH, etc., and make sure each strange condition is handled with good information outputted. But, I do see that if you try to use an ancient java (jdk v7(), it crashes without any real information just as you encountered. Thanks for the info.

kaby76 avatar Aug 24 '22 10:08 kaby76

Added in a version check, will release in 11.0 of Antlr4BuildTasks. https://github.com/kaby76/Antlr4BuildTasks/commit/d212f0f74c9f3fe47570ceeda46f617ce618b54d

kaby76 avatar Aug 24 '22 13:08 kaby76

Thanks for adding more tests and a better error output. Effectively on my main computer I had SDK 11 and 17 installed. On the other computer SDK 8 or 9 => I had the problem. For my friend, which reported the error to me, he solved also the problem by installing JDK 18.

Philippe-Laval avatar Aug 24 '22 16:08 Philippe-Laval