]
Koen Aers commented on JBIDE-19792:
-----------------------------------
Hi Bastian,
Not exposing the Hibernate runtime and its dependencies is something we had to do to
properly support the simultaneous use of multiple Hibernate versions in JBoss Tools. I
don't know if you noticed this, but the 'org.hibernate.eclipse.libs' plugin
contained Hibernate version 3.5.x and its dependencies only. The entire runtime provision
system was redesigned and reimplemented starting with Luna and even further in Mars. It
will probably need more significant changes to support Hibernate 5 which is now in Beta.
As a matter of fact the entire 'org.hibernate.eclipse.libs' plugin is removed in
the Mars development stream and was only used for testing purposes in the Luna release.
To solve your problem, I it should probably be enough to depend on the
'org.jboss.tools.hibernate.antlr' plugin. Be aware however that in the Mars
development stream this plugin was renamed to
'org.jboss.tools.hibernate.libs.antlr.v_2_7_7'. Let us know how it goes and if we
can resolve this issue.
Cheers,
Koen
antlr packages and lib not exported in Hibernate Tools 4.0.1
------------------------------------------------------------
Key: JBIDE-19792
URL:
https://issues.jboss.org/browse/JBIDE-19792
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: hibernate
Affects Versions: 4.2.3.Final
Environment: Eclipse Luna SR2
Reporter: Bastian Ulke
Assignee: Koen Aers
Attachments: B82_MANIFEST.MF, B95_MANIFEST.MF
I am currently working on an Eclipse-Plugin that is built on top of the
Hibernate Tools project. For example, I am using the following statements
to get the AST of a named query:
{code}
try {
HqlParser parser = HqlParser.getInstance(statementString);
parser.statement();
} catch (RecognitionException | TokenStreamException e) {
e.printStackTrace();
}
AST statementAst = parser.getAST();
{code}
For this to work well with Hibernate Tools Version 4.0.0, I added bundle
org.hibernate.eclipse.libs as required bundle to my plug-in configuration
(which resolved to
org.hibernate.eclipse.libs_4.0.0.Final-v20141016-1911-B82 so far).
However, I now updated to Hiberate Tools 4.0.1
(org.hibernate.eclipse.libs_4.0.1.Final-v20150324-2307-B95). The problem I
have now is that the following imports cannot be resolved:
import antlr.RecognitionException;
import antlr.TokenStreamException;
import antlr.collections.AST;
The problem seems to arise from the fact, that in the new version's
MANIFEST.MF, the antlr... packages are not exported and
lib/hibernate/antlr-2.7.6.jar is not listed in the Bundle-ClassPath any
more (I reformatted both MANIFEST.MFs, that you can find attached, to allow
a convenient comparison). After manually adding the antlr-related entries
to the new version's MANIFEST.MF, my code works pretty well again.
I agree, that internal libraries should generally not be exported. However,
org.hibernate.hql.ast.HqlParser is exported -- so why not its prerequesites?
(By the way, I'd be fine with integrating another library into my project.
However, I tried to manally add antlr-2.7.6.jar as library to
my project, which solved the compilation error, but yields a
java.lang.ClassNotFoundException: antlr.LLkParser cannot be found by
org.hibernate.eclipse.libs_4.0.1.Final-v20150324-2307-B95.)