How do I install Preon?

776 Views Asked by At

I am trying to install preon and run it within IntelliJ.

I have downloaded the source code from https://github.com/preon/preon.

Then I open the project with IntelliJ.

Then I download pecia and import it as a module into the preon project.

Then I try to run the BitmapFileTest program at ...preon-master/preon-samples/preon-sample-bmp/src/test/java/org/codehaus/preon/sample/bmp/BitmapFileTest.java

Here are the first few errors that I get:

...preon-master/preon-el/src/main/java/org/codehaus/preon/el/Expressions.java

  • Error:(151, 24) java: cannot find symbol symbol: class LimboWalker location: class org.codehaus.preon.el.Expressions
  • Error:(154, 9) java: cannot find symbol symbol: class LimboLexer location: class org.codehaus.preon.el.Expressions
  • Error:(154, 32) java: cannot find symbol symbol: class LimboLexer location: class org.codehaus.preon.el.Expressions
  • Error:(156, 9) java: cannot find symbol symbol: class LimboParser location: class org.codehaus.preon.el.Expressions
  • Error:(156, 34) java: cannot find symbol symbol: class LimboParser location: class org.codehaus.preon.el.Expressions
  • Error:(160, 9) java: cannot find symbol symbol: class LimboWalker location: class org.codehaus.preon.el.Expressions
  • Error:(160, 55) java: cannot find symbol symbol: class LimboWalker location: package org.codehaus.preon.el

For some reason the compiler cannot find the Limbo classes in its own project.

What do I need to do to be able to build and run this sample project?

1

There are 1 best solutions below

2
On BEST ANSWER

The problem is that these classes are generated by ANTLR from Limbo.g and LimboWalker.g, but IntelliJ doesn’t automatically know how to use ANTLR to build them.

There is an ANTLRWorks plugin for IntelliJ that supports ANTLR version 3, but it was last updated in 2009 and doesn’t seem to work in IntelliJ 13.

There is a newer “ANTLR v4 grammar plugin” that is actively maintained, but it is only for ANTLR 4, and preon is still on ANTLR 3.

But the Maven plugin for ANTLR is stable and can build it.

What you need to do is: right-click preon-el in Project, then choose the Maven → Generate Sources and Update Folders menu option. This will call the Maven plugin to generate LimboWalker.class from LimboWalker.g, among other things.

Then choose Build → Make Project, and the BitmapFileTest will run.