Hello I am new in eclipse-plugin development and I am starting a project to incorporate a translator in an eclipse-plugin and for this purpose I started by using the eclipse plugin hello word example and the grammar file provided in this example, I am able to compile my project and run the plug in but when I try to load the parser I get an exception 'Caused by: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/CharStream', I don't know what the problem could be, I have already tested the parser, but outside plug in environment and works fine.
I am also trying to incorporate maven to download the dependencies and run antlr so I added this in the pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.plugin.helloworld</groupId>
<artifactId>org.plugin.helloworld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>4.7.1</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.7.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.7.1</version>
<configuration>
<sourceDirectory>src/evaluator</sourceDirectory>
<outputDirectory>src/evaluator</outputDirectory>
<visitor>true</visitor>
<listener>false</listener>
</configuration>
<executions>
<execution>
<id>antlr</id>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I am using the lexer and the parser as follows:
public class SampleHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
CharStream in = CharStreams.fromString("\"12*(5-6)\"");
evaluatorLexer lexer = new evaluatorLexer(in);
CommonTokenStream tokens = new CommonTokenStream(lexer);
evaluatorParser parser = new evaluatorParser(tokens);
MessageDialog.openInformation(
window.getShell(),
"Helloworld",
parser.eval().toString());
return null;
}
}
And the referenced libraries like this:
I set the build.properties as follows
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
lib/antlr4-runtime-4.7.1.jar,\
lib/ST4-4.0.8.jar,\
lib/antlr4-4.7.1.jar,\
lib/antlr4-runtime-4.7.1-sources.jar
I read about adding as a bundle in the manifest but I can't find that option in the dependencies tab just the org.antlr.runtime not the v4.