user902383
user902383

Reputation: 8640

ANTLR4 under eclipse generates sources inside incorrect packages

I'm trying to convert my project to antlr4. I converted grammar, but i can't generated sources to correct package.

When I run build, Eclipse placed generated sources in incorrect packages. If i place my grammar directly inside src/, sources are generating inside default package. If i move my grammar to be inside package my.sources.package, Eclipse generates correctly entire package structure, but it place it relatively to place where is the grammar my.sources.package.my.sources.package.

If that helps, i'm using Eclipse Luna 4.4.2, antlr4ide 0.3.5 and Antler 4.4

Upvotes: 2

Views: 358

Answers (1)

Eric
Eric

Reputation: 31

Don't put the grammar files inside a Java package. Add 'folders' under src with the path you want to create for the package name.

In the project properties, go to ANTLR4 -> Tool and set the desired output directory in the Options -> Directory field.

Attached is a screenshot showing the directory structure and properties window.

Screenshot showing directory structure and properties window

Upvotes: 3

Related Questions