Problems Using ANTLR4 (Packaged Classes Not Found in Generated Code)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems Using ANTLR4 (Packaged Classes Not Found in Generated Code)

R0b0t1
Is any more information needed? The files are generated properly by
ANTLR, but I can not compile the generated files.

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/R0b0t1/Documents/Code/grammar-mvn/target/generated-sources/antlr4/GrammarParser.java:[32,29]
cannot find symbol
  symbol:   class Vocabulary
  location: class LangParser

And so on. I followed
http://www.antlr.org/api/maven-plugin/latest/usage.html and
http://www.antlr.org/api/maven-plugin/latest/dependency-info.html.

I am not very smart. I have spent a few days trying to figure out the
best way to compile a Java project. I have tried Ant, CMake, and now
Maven. Maven seems like the easiest to use, but I can not solve this
problem I am having.

Respectfully,
     R0b0t1.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problems Using ANTLR4 (Packaged Classes Not Found in Generated Code)

Karl Heinz Marbaise-3
Hi,

can make a test project on Github/gitlab etc.

Kind regards
Karl Heinz Marbaise
On 29/10/17 05:13, R0b0t1 wrote:

> Is any more information needed? The files are generated properly by
> ANTLR, but I can not compile the generated files.
>
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] /C:/Users/R0b0t1/Documents/Code/grammar-mvn/target/generated-sources/antlr4/GrammarParser.java:[32,29]
> cannot find symbol
>    symbol:   class Vocabulary
>    location: class LangParser
>
> And so on. I followed
> http://www.antlr.org/api/maven-plugin/latest/usage.html and
> http://www.antlr.org/api/maven-plugin/latest/dependency-info.html.
>
> I am not very smart. I have spent a few days trying to figure out the
> best way to compile a Java project. I have tried Ant, CMake, and now
> Maven. Maven seems like the easiest to use, but I can not solve this
> problem I am having.
>
> Respectfully,
>       R0b0t1.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problems Using ANTLR4 (Packaged Classes Not Found in Generated Code)

Robert Patrick
Most likely, you need to add a compile-time dependency on the antlr runtime library, where the missing class is located.

<dependency>
    <groupId>org.antlr</groupId>
    <artifactId>antlr4-runtime</artifactId>
    <version>4.7</version>
</dependency>


> On Oct 29, 2017, at 2:43 AM, Karl Heinz Marbaise <[hidden email]> wrote:
>
> Hi,
>
> can make a test project on Github/gitlab etc.
>
> Kind regards
> Karl Heinz Marbaise
>> On 29/10/17 05:13, R0b0t1 wrote:
>> Is any more information needed? The files are generated properly by
>> ANTLR, but I can not compile the generated files.
>> [INFO] -------------------------------------------------------------
>> [ERROR] COMPILATION ERROR :
>> [INFO] -------------------------------------------------------------
>> [ERROR] /C:/Users/R0b0t1/Documents/Code/grammar-mvn/target/generated-sources/antlr4/GrammarParser.java:[32,29]
>> cannot find symbol
>>   symbol:   class Vocabulary
>>   location: class LangParser
>> And so on. I followed
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.antlr.org_api_maven-2Dplugin_latest_usage.html&d=DwICaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=Ql5uwmbofQMW0iErugdCnFgO-CBGr_pt_OzwdxJosG0&m=nRiDxwbhq-IuQJmgLg2hhUqK_UsIqKWJAqUcywTbz-Y&s=9YiehKVhRPHh6AA9LGHQ5Fhbj5FKWZ4POGIAyeXDD6Y&e= and
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.antlr.org_api_maven-2Dplugin_latest_dependency-2Dinfo.html&d=DwICaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=Ql5uwmbofQMW0iErugdCnFgO-CBGr_pt_OzwdxJosG0&m=nRiDxwbhq-IuQJmgLg2hhUqK_UsIqKWJAqUcywTbz-Y&s=IjFObLVM57HemB8uaI20Eq7Qe7CY2VNfOQA7O5qQfZ8&e=.
>> I am not very smart. I have spent a few days trying to figure out the
>> best way to compile a Java project. I have tried Ant, CMake, and now
>> Maven. Maven seems like the easiest to use, but I can not solve this
>> problem I am having.
>> Respectfully,
>>      R0b0t1.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problems Using ANTLR4 (Packaged Classes Not Found in Generated Code)

R0b0t1
Hello friends,

On Sun, Oct 29, 2017 at 2:43 AM, Karl Heinz Marbaise <[hidden email]> wrote:
> Hi,
>
> can make a test project on Github/gitlab etc.
>
> Kind regards
> Karl Heinz Marbaise
>

Here is a repository: https://github.com/R030t1/antlr4-mvn. You should
be able to run `mvn compile` to receive the errors I am receiving.


On Sun, Oct 29, 2017 at 8:10 AM, Robert Patrick
<[hidden email]> wrote:
> Most likely, you need to add a compile-time dependency on the antlr runtime library, where the missing class is located.
>
> <dependency>
>     <groupId>org.antlr</groupId>
>     <artifactId>antlr4-runtime</artifactId>
>     <version>4.7</version>
> </dependency>
>

It seems this was it, thank you. I am not sure why this is not
mentioned anywhere.

Cheers,
     R0b0t1

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problems Using ANTLR4 (Packaged Classes Not Found in Generated Code)

Russell Gold-3
Interesting. I see:

> Durendal:antlr4-mvn russgold$ mvn clean compile
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] Building antlr4-mvn 1.0-SNAPSHOT
> [INFO] ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ antlr4-mvn ---
> [INFO] Deleting /Users/russgold/projects/exercises/antlr4-mvn/target
> [INFO]
> [INFO] --- antlr4-maven-plugin:4.7:antlr4 (antlr) @ antlr4-mvn ---
> [INFO] ANTLR 4: Processing source directory /Users/russgold/projects/exercises/antlr4-mvn/src/main/antlr4
> [INFO] Processing grammar: Grammar.g4
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ antlr4-mvn ---
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] skip non existing resourceDirectory /Users/russgold/projects/exercises/antlr4-mvn/src/main/resources
> [INFO]
> [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ antlr4-mvn ---
> [INFO] Changes detected - recompiling the module!
> [INFO] Compiling 5 source files to /Users/russgold/projects/exercises/antlr4-mvn/target/classes
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1.496 s
> [INFO] Finished at: 2017-10-29T19:27:15-04:00
> [INFO] Final Memory: 22M/378M
> [INFO] ------------------------------------------------------------------------


What version of maven are you using? What JDK?

> Durendal:antlr4-mvn russgold$ mvn -version
> Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
> Maven home: /opt/local/share/java/maven3
> Java version: 1.8.0_60, vendor: Oracle Corporation
> Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"


- Russ


> On Oct 29, 2017, at 7:07 PM, R0b0t1 <[hidden email]> wrote:
>
> Hello friends,
>
> On Sun, Oct 29, 2017 at 2:43 AM, Karl Heinz Marbaise <[hidden email]> wrote:
>> Hi,
>>
>> can make a test project on Github/gitlab etc.
>>
>> Kind regards
>> Karl Heinz Marbaise
>>
>
> Here is a repository: https://github.com/R030t1/antlr4-mvn. You should
> be able to run `mvn compile` to receive the errors I am receiving.
>
>
> On Sun, Oct 29, 2017 at 8:10 AM, Robert Patrick
> <[hidden email]> wrote:
>> Most likely, you need to add a compile-time dependency on the antlr runtime library, where the missing class is located.
>>
>> <dependency>
>>    <groupId>org.antlr</groupId>
>>    <artifactId>antlr4-runtime</artifactId>
>>    <version>4.7</version>
>> </dependency>
>>
>
> It seems this was it, thank you. I am not sure why this is not
> mentioned anywhere.
>
> Cheers,
>     R0b0t1
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

Re: Problems Using ANTLR4 (Packaged Classes Not Found in Generated Code)

R0b0t1
On Sun, Oct 29, 2017 at 6:29 PM, Russell Gold <[hidden email]> wrote:

> Interesting. I see:
>
>> Durendal:antlr4-mvn russgold$ mvn clean compile
>> [INFO] Scanning for projects...
>> [INFO]
>> [INFO] ------------------------------------------------------------------------
>> [INFO] Building antlr4-mvn 1.0-SNAPSHOT
>> [INFO] ------------------------------------------------------------------------
>> [INFO]
>> [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ antlr4-mvn ---
>> [INFO] Deleting /Users/russgold/projects/exercises/antlr4-mvn/target
>> [INFO]
>> [INFO] --- antlr4-maven-plugin:4.7:antlr4 (antlr) @ antlr4-mvn ---
>> [INFO] ANTLR 4: Processing source directory /Users/russgold/projects/exercises/antlr4-mvn/src/main/antlr4
>> [INFO] Processing grammar: Grammar.g4
>> [INFO]
>> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ antlr4-mvn ---
>> [INFO] Using 'UTF-8' encoding to copy filtered resources.
>> [INFO] skip non existing resourceDirectory /Users/russgold/projects/exercises/antlr4-mvn/src/main/resources
>> [INFO]
>> [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ antlr4-mvn ---
>> [INFO] Changes detected - recompiling the module!
>> [INFO] Compiling 5 source files to /Users/russgold/projects/exercises/antlr4-mvn/target/classes
>> [INFO] ------------------------------------------------------------------------
>> [INFO] BUILD SUCCESS
>> [INFO] ------------------------------------------------------------------------
>> [INFO] Total time: 1.496 s
>> [INFO] Finished at: 2017-10-29T19:27:15-04:00
>> [INFO] Final Memory: 22M/378M
>> [INFO] ------------------------------------------------------------------------
>
>
> What version of maven are you using? What JDK?
>
>> Durendal:antlr4-mvn russgold$ mvn -version
>> Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
>> Maven home: /opt/local/share/java/maven3
>> Java version: 1.8.0_60, vendor: Oracle Corporation
>> Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
>> Default locale: en_US, platform encoding: UTF-8
>> OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
>
>

My apologies Mr. Gold, I wrote my email in two parts. I added Mr.
Patrick's suggestion (the dependency on the antlr4 runtime) and the
project compiled.

Cheers,
     R0b0t1.

$ mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06;
2015-04-22T06:57:37-05:00)
Maven home: /usr/share/maven-bin-3.3
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /usr/lib64/icedtea8/jre
Default locale: en_US, platform encoding: UTF-8

>
>> On Oct 29, 2017, at 7:07 PM, R0b0t1 <[hidden email]> wrote:
>>
>> Hello friends,
>>
>> On Sun, Oct 29, 2017 at 2:43 AM, Karl Heinz Marbaise <[hidden email]> wrote:
>>> Hi,
>>>
>>> can make a test project on Github/gitlab etc.
>>>
>>> Kind regards
>>> Karl Heinz Marbaise
>>>
>>
>> Here is a repository: https://github.com/R030t1/antlr4-mvn. You should
>> be able to run `mvn compile` to receive the errors I am receiving.
>>
>>
>> On Sun, Oct 29, 2017 at 8:10 AM, Robert Patrick
>> <[hidden email]> wrote:
>>> Most likely, you need to add a compile-time dependency on the antlr runtime library, where the missing class is located.
>>>
>>> <dependency>
>>>    <groupId>org.antlr</groupId>
>>>    <artifactId>antlr4-runtime</artifactId>
>>>    <version>4.7</version>
>>> </dependency>
>>>
>>
>> It seems this was it, thank you. I am not sure why this is not
>> mentioned anywhere.
>>
>> Cheers,
>>     R0b0t1
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]