Home » Modeling » M2T (model-to-text transformation) » Comprehensive list of rules for JET classpath
|Comprehensive list of rules for JET classpath [message #54073]
||Mon, 15 December 2008 19:12
| Paul Hammond
Registered: July 2009
Despite having been able to develop custom tags and see them run, I'm
having some problems with those that are referring to 3rd party libraries.
I know you've posted on this before, and having read all of those posts
and checked everything I've done, I'm still getting problems, and have
spend over a day making tweaks, stopping and restarting trying to figure
this out to no avail, it's a bit confusing, the JET2 runtime rules of
engagement. I'd just like to clear this up as best as possible.
I'm going to describe what I do to try in light of the fact that JET2 does
some trickery by faking a transformation as a temporary plugin etc. If you
could please show me where I'm going wrong.
I have a JET transformation project just containing templates, let's call
I also have my own separate plugin project, let's call it
CustomPluginProject, which contains my own custom tags. I have no problem
getting tags recognised, configured as an extension at all.
In the implementation of my tags, they call my own custom non-tag classes,
which I also include in the CustomPluginProject. Everything compiles no
CustomPluginProject classes refer to quite a few of the Apache Commons
To keep everything working in the Eclipse plugin framework, I've created
my own Eclipse plugins for these libraries, and added these as plugin
dependencies to CustomPluginProject. All packages are fully exported in
I export CustomPluginProject to a plugin JAR in the Eclipse plugins
directory, and restart with -clean.
I make CustomPluginProject a plugin dependency of JETProject.
I then 'Run as transformation' my sample XML file.
What I find:
As you've previously posted, JET only sees the classes in the
CustomPluginProject directly, it does not see any of the plugins that
CustomPluginProject itself depends on even if you re-export them.
With that in mind, I manually add one Apache Commons plugin as a plugin
dependency of JETProject.
Just as a test, in the main.jet template, I have some simple Java imports
of the Apache classes, and do some trivial object instantiations. Seems to
work fine. So far so good.
However, when any of the CustomPluginProject classes have to run as part
of a real JET transformation, they must not be able to see any of the one
Apache linrary I manually added because I get a
java.lang.NoClassDefFoundError exception for the same classes I was able
to use in main.jet
If I run these same classes in CustomPluginProject on their own in a
simple Java main, they have no such classpath issues, this is only
happening inside JET.
So I've tried removing the Apache plugin dependency from the JET project,
and adding it as a straight library dependency, which didn't work as in
Java Build Path/Libraries I had added 'Plugin Dependencies' which means
that adding the Apache plugin clashed with the entry in the Plugin
Dependencies coming from CustomPluginProject.
I tried adding it as a system library so it's on the boot classpath (I
assume JETs class loader would have the main Eclipse classloader as a
parent?) and that didn't work either.
I'm at a complete crossroads here, any advice on what I'm doing wrong
would be great.
Is it the case that for any 3rd party library L, that I want to use in my
CustomPluginProject and hence in JETProject at transformation time, I have
to avoid creating it as a plugin and adding it into CustomPluginProject,
but rather add it as an external JAR to both CustomPluginProject and
JETProject and just forget about plugins completely?
What is the sure fire way, regardless of even convenience, that I can set
this up so that I can guarantee that any code I want can be seen by JET?
|Re: Comprehensive list of rules for JET classpath [message #54467 is a reply to message #54231]
||Wed, 17 December 2008 16:04
| Paul Hammond
Registered: July 2009
Yes, I am using the existing Eclipse Apache commons plugins where I can.|
When I add my plugins as dependencies to my custom tags plugin project, I
click Properties on each one and check the 'Reexport dependency' on them.
I guess this makes JET then have explicit dependencies on these projects
instead of just depending on my custom tags plugin alone.
That seemed to work for me in that things got to where some code I wanted
executed was getting executed now with no missing class exceptions.
However I made some modifications, added a new 3rd library as a plugin I
prepared, using the same method, made some code changes, re exported,
restarted Eclipse etc, and now I just get:
'Could not load template error' with no log messages on the console,
problem or error view so I've nothing to go on.
The setup, most likely down to me, is just very brittle.
Current Time: Tue Jul 26 10:20:39 GMT 2016
Powered by FUDForum
. Page generated in 0.01601 seconds