kaby76 / Antlr4BuildTasks

Third-party build tool for 'Official' Antlr4 tool and runtime parsers using .Net. Drop-in replacement for 'Antlr4cs' Antlr4 tool and build rules.
MIT License
75 stars 10 forks source link

Error with Visual Studio 17.3.1 #41

Open Philippe-Laval opened 2 years ago

Philippe-Laval commented 2 years ago

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 commented 2 years ago

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>
kaby76 commented 2 years ago

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 commented 2 years ago

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

Philippe-Laval commented 2 years ago

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.