Building Standalone Compiler with Maven - My Method No Longer Works [message #1850515] |
Mon, 07 March 2022 13:58 |
Brandon Lewis Messages: 268 Registered: May 2012 |
Senior Member |
|
|
This seems like a topic that everyone must deal with, but there's not many examples (I guess it's a Maven thing.. but since most of us must deal with it at some point....)
For years now I've been building my standalone compiler jars using a method based on Lorenzo Bettini's method documented here:
https://github.com/LorenzoBettini/packtpub-xtext-book-2nd-examples/blob/master/org.example.smalljava.parent/org.example.smalljava/pom.xml
For whatever reason, and I can't figure it out after days of cursing at it, it no longer works and builds a jar with a blank org.eclipse.emf.common jar and nothing works anymore (the emf.common jar has no classes and just a manifest file - I suspect the maven shade plugin is causing me grief, but I have no idea how it works (it's used in building the LSP in the ide plugin).
Every single plugin, eclipse version, tycho version, etc, has changed and all xtext example poms are all slightly different and I can't detect what in the world is going wrong. But it's dead for me and I'm too dumb to figure it out.
So I'm stuck manually exporting my jar from Eclipse - which works.
So I've started looking for another way. I stumbled upon this:
https://github.com/basilfx/xtext-standalone-maven-build
it seems very straightforward and simple, but unfortunately it is not working. (it appears to be 5 years old and based on xtext 2.12, so who knows...)
When I launch the resulting jar with java - jar <the jar>, it can find my Main class - which is the _entire point_.
I've seen some other xtext projects in github using the later method, so it works for some people.
Yes, my Main.class is in the resulting jar, but the JarRsrcLoader can't seem to find it.
Anyone using this later method with success?
|
|
|
|
Re: Building Standalone Compiler with Maven - My Method No Longer Works [message #1850867 is a reply to message #1850527] |
Sun, 20 March 2022 00:27 |
Brandon Lewis Messages: 268 Registered: May 2012 |
Senior Member |
|
|
Christian Dietrich wrote on Mon, 07 March 2022 10:28hi,
can you describe "what" is not working? did you remote debug into it?
My method that had been working for years:
https://github.com/LorenzoBettini/packtpub-xtext-book-2nd-examples/blob/master/org.example.smalljava.parent/org.example.smalljava/pom.xml
For some unexplained reason, the maven-dependency-plugin copies the org.emf.common.2.19 plugin into the resulting jar - but it doesn't copy ANY of it's classes. Instead of a 367KB emf.common jar in my fatjar, I get a 19KB jar that has a manifest, but it has ZERO classes.
The command line compiler immediately exceptions because it can't find "common emf" stuff. I've spent hours/days cursing at Maven but I can't get it to copy this particular JAR (there may be more it's messing up, but I can't even start).
maven-dependency-plugin just seems to not be doing what it's supposed to do? I can't explain it because it's a "magic maven thing". I have debugged it to show that the copy of the emf.common jar the maven-dependency-plugin copies into the lib jar is messed up and incomplete.
Quote:
did you check what the new project wizard creates when you select lsp fat jar?
I've looked at it, but I don't understand it. I understand it's building the jar for the LSP, but I don't see anything familiar with specific my Main class and specifying what the compile jar's name looks like. I'm pretty lost on it.
This other method, new to me but fairly old:
https://github.com/basilfx/xtext-standalone-maven-build
Appears to run smoothy. Appears to copy everything it needs, Appears to build a proper manifest file in the fat jar... then when I run it, Java says it can't find the Main class - even though I clearly see it in the manifest's listed classpath and the class lives at that location in the jar.
It's weird, it's such a fundamental failure, but it all looks setup correctly to me.
I don't know how to remote debug unfortunately, I've always used Eclipse's debugger.
[Updated on: Sun, 20 March 2022 00:39] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04006 seconds