Lombok install interferes with RCP export wizard #145

Closed
lombokissues opened this Issue Jul 14, 2015 · 27 comments

Projects

None yet

2 participants

@lombokissues
Collaborator

Migrated from Google Code (issue 72)

@lombokissues
Collaborator

๐Ÿ‘ค evan.mclean ย  ๐Ÿ•— Nov 27, 2009 at 03:02 UTC

What steps will reproduce the problem?

  1. Start with an installation of Eclipse without Lombok installed.
  2. Open your RCP based project, open the build.product file, click on the
    "Eclipse Product export wizard" and follow the dialogues to perform an
    export. Ensure that this all works as expected.
  3. Close down eclipse and install lombok.
  4. Start eclipse, and repeat step 2.

What is the expected output? What do you see instead?
Upon clicking the "Finish" button in the dialogue, you expect it to perform
the export. With Lombok installed you get an error dialogue box instead
(see attached image).

What version of the product are you using? On what operating system?
Lombok 0.9.1.
Eclipse 3.5
Windows XP.

Please provide any additional information below.

@lombokissues
Collaborator

๐Ÿ‘ค evan.mclean ย  ๐Ÿ•— Nov 27, 2009 at 03:02 UTC

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Dec 04, 2009 at 21:13 UTC

@lombokissues
Collaborator

๐Ÿ‘ค dcendents ย  ๐Ÿ•— Dec 08, 2009 at 15:56 UTC

I really like the idea behind project Lombok, however I cannot start using it until
this issue is fixed, we develop RCP products.

We use the headless build and I installed lombok on our target platform installation
(which performs the build). I get the same error, but I can see the real error is:

Internal compiler error: java.lang.NoClassDefFoundError:
com/sun/tools/javac/processing/JavacProcessingEnvironment at
lombok.javac.apt.Processor.init(Processor.java:74)

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Dec 08, 2009 at 16:17 UTC

You may be able to work around this problem by adding tools.jar to your system classpath.

@lombokissues
Collaborator

๐Ÿ‘ค dcendents ย  ๐Ÿ•— Dec 09, 2009 at 13:47 UTC

I don't want to add things to the system classpath, I want the projects as
self-contained as possible. People should check it out of subversion and work with it
without having to modify their system classpath.

I have a script that builds the classpath installation, so adding lombok is not an
issue for that.

I tried to add tools.jar to my plugin libraries, but now during the headless build I
have a different error:

You aren't using a compiler based around javac v1.6, so lombok will not work properly.

I have the following properties in build.properties:

JavaSE-1.6=C:/dev/Java/jre6/lib/rt.jar
logExtension=.log
javacDebugInfo=true
javacFailOnError=true
javacVerbose=false
javacSource=1.6
javacTarget=1.6

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Dec 16, 2009 at 14:06 UTC

I have the problem when exporting a product using the command line:
My command line is:
eclipse.exe -nosplash -application org.eclipse.ant.core.antRunner -buildfile
"${eclipse.home}\plugins\org.eclipse.pde.build_3.3.2.R331_v20071019\scripts\productBuild\productBuild.xml"
-Dbuilder="${basedir}/../buildConfiguration"
-Dproduct="/com.cofluent.studio/cofluentstudio.product" -Dbase="${eclipse.home}/.."
-DbaseLocation="${eclipse.home}" -DbuildDirectory="${buildDirectory}"
-Dconfigs=win32,win32,x86 -DarchivePrefix=cofluent -DjavacTarget=1.6
-DjavacSource=1.6 -vmargs -javaagent:lombok.jar -Xbootclasspath/a:lombok.jar;tools.jar

Eclipse generates ant build file with this:






lombok is not taken into account at all during compilation.

I tried to pass vmargs, without success, any ideas ?

@lombokissues
Collaborator

๐Ÿ‘ค mail.carsten.lenz ย  ๐Ÿ•— Dec 17, 2009 at 10:05 UTC

For running a headless build you can add the line:

build.compiler=modern

to your build.properties file in the /buildConfiguration directory of your
product-plugin.

And of course you need lombok.jar in the classpath the plugins which use lombok
annotations.

For exporting: we ran into the same issue with no solution yet. You somehow have to
convince the eclipse pde export wizard to use the jdk-compiler (modern) in his
generated ant files...

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Dec 18, 2009 at 16:40 UTC

Thanks a lot. It almost worked, but I have another issue which has nothing to do with
lombok ( an OutOfMemory with javac :( I've tried with -J-Xmx500m, but it seems that
AntRunner doesn't appreciate it at all ).

I will try with delombok instead (put into the customCallback.xml), it should work in
theory, but it is quite a pain in practice :( I did not have to to investigate yet.

I think that solution (customCallback.xml & delombok) should work with export as
well, I will let you know if this is the case.

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Dec 21, 2009 at 09:51 UTC

Unfortunatly, the customCallbacks.xml is not called during when exporting a
deployable feature :(

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Dec 21, 2009 at 11:22 UTC

So, if I understand this correctly, the Eclipse RCP deployment wizard produces an on-the-fly ant build file
which is then immediately run, and the immediate problem with this is that the generated ant fly cannot be
modified and defaults to the ecj compiler (which lombok cannot work with as an annotation processor at the
moment).

We could investigate if we can make lombok work in the ecj annotation processor environment, but if this is
really the only time that is likely to come up, it might be simpler to just patch the RCP deployment wizard to
emit a in the generated ant file. That sounds
ridiculously simple.

If you guys can chase down some sort of class name, project, or preferably, the source file that generates this
ant file (or even a dump of what it looks like, which should help find the code that generates this), we might
be able to hack up a quick fix for this.

@lombokissues
Collaborator

๐Ÿ‘ค dcendents ย  ๐Ÿ•— Dec 21, 2009 at 15:27 UTC

In my case, a simple RCP application built using the headless build, setting the
compiler to modern fixed everything.

1- Install lombok in the target platform (used for building the code), this is
identical as the install in the development eclipse, execute the lombok.jar.
2- Add lombok.jar in your plugin, start using it in your code.
3- Add build.compiler=modern in build.properties

We also use obfuscate4e and no problem to report there as well, the generated code
gets obfuscated as before.

Christophe, you might want to do this instead of messing with the headless build
itself, it might work for you too.

Will look forward to use lombok now!

@lombokissues
Collaborator

๐Ÿ‘ค mail.carsten.lenz ย  ๐Ÿ•— Dec 21, 2009 at 16:40 UTC

I thought I tried this on the PDE Export Wizard. My experience was that the export
wizard does not honour the build.properties setting build.compiler=modern.
The headless build runs just fine. As Reinier suggested I'll dive into the source of
the wizard and it's ant files.

@lombokissues
Collaborator

๐Ÿ‘ค evan.mclean ย  ๐Ÿ•— Dec 21, 2009 at 23:05 UTC

I should add that the RCP project doesn't even have to be using Lombok, Lombok just
has to be installed into Eclipse to cause the error. (Gave me great consternation
while trying to export an old RCP project until I figured that out.)

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Dec 22, 2009 at 09:51 UTC

Thanks Dcendents, as I said changing "build.compiler" to modern almost works (because
javac misses heap memory, and doesn't recognize -J-Xmx parameter). Moreover, I'd like
the export Product/Feature/Plugins work, because in an industrial context (as I am),
I find it convenient to make a quick release to provide a patch or something else.
Before migrating to "lombok" for our commercial software, I want to trust it 99% :).

I made some research on PDE code, but it seems quite a pain to extend it. There is 3
export kinds:

  • Export Product: entry point ProductExportWizard, interesting method is private
    ProductExportOperation.createBuildPropertiesFile(String featureLocation, String[]
    config) in org.eclipse.core.pde.core.
  • Export Feature/Plugins: entry points are FeatureExportOperation &
    PluginExportWizard. Interesting methods are protected abstract
    AntGeneratingExportWizard.generateAntTask() (overriden in FeatureExportOperation &
    PluginExportWizard) in org.eclipse.core.pde.ui.

I am using Eclipse 3.3, I wonder it there was changes in recent releases.

I don't know if we could use frameworks like ASM to hook those methods ? Seems like
tricky :(

Moreover, there might be some side effect for changing this: what if there is no
JAVA_HOME variable defined ? what if the user cant to use a specific JRE ?

Is it to complicated to make "Export" work with Eclipse Compiler ?

@lombokissues
Collaborator

๐Ÿ‘ค dcendents ย  ๐Ÿ•— Dec 22, 2009 at 10:05 UTC

I also work in an industrial context. I just feel scripting the build with ant makes
it safer, no user mistake and 2 people building it gets the same result every time. I
suggest you always use the latest stable eclipse (3.5) to build and define a target
platform (3.3) to build against. This way you get all the latest benefits when
building without having to migrate your product to 3.5

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Dec 30, 2009 at 01:34 UTC

Hey guys, I think Roel and I just fixed this issue, though my eclipse isn't ready for RCP projects (I think... I
can create a new plugin or feature project, but not a new 'RCP project' - no such wizard in the projects...
dialog). Can you test this for us? Lombok will definitely work in standalone ECJ (tested that ourselves), and
we're fairly sure it should also run in any ECJs spawned directly by eclipse in the same JVM. Tested with ecj
3.5.1.

You can download the edge build, with this fix in it, from here:

https://projectlombok.org/download-edge.html

@lombokissues lombokissues removed the accepted label Jul 14, 2015
@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Dec 30, 2009 at 09:25 UTC

Still not working for me, I am using eclipse 3.3:
Problems during export:

C:\work\work3.2.metadata.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.containe
r.feature\build.xml:29: The following error occurred while executing this line:
C:\work\work3.2.metadata.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.containe
r.feature\build.xml:10: The following error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:425: The following
error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:201:
java.lang.reflect.InvocationTargetException
The following error occurred while executing this line:
C:\work\work3.2.metadata.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.containe
r.feature\build.xml:10: The following error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:425: The following
error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:201:
java.lang.reflect.InvocationTargetException

C:\work\work3.2.metadata.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.containe
r.feature\build.xml:29: The following error occurred while executing this line:
C:\work\work3.2.metadata.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.containe
r.feature\build.xml:10: The following error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:425: The following
error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:201:
java.lang.reflect.InvocationTargetException
The following error occurred while executing this line:
C:\work\work3.2.metadata.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.containe
r.feature\build.xml:10: The following error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:425: The following
error occurred while executing this line:
C:\work\work3.2\com.cofluent.studio.internal.commons\build.xml:201:
java.lang.reflect.InvocationTargetException

Did I made something wrong ?

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Dec 31, 2009 at 05:47 UTC

Yikes. That is an utterly useless error message. InvocationTargetException means we use reflection
somewhere to call something else, and THAT call is throwing an exception. That exception is marked as the
'cause' of the InvocationTargetException and it, along with its stack trace, should help us solve this issue. Is
there anything in the error logs that's more useful than this?

Eclipse 3.3 could be a problem; last time I checked lombok works with eclipses as far back as 3.2, but that
was a long time ago, this is very much treading new ground (so there's ample reason to believe old versions of
eclipse aren't compatible with what we do) and we don't make it a point of policy to support any eclipses
before 3.5, which has been out and stable for a long time now.

Does anyone else have this error?

At any rate, it would help if someone can tell me exactly how one creates an RCP project. We've never done
this before so we have never actually reproduced this issue, we're just shooting in the dark. Assume we're
dummies and take us through a simple test case, step by step. Endless kudos and gratitude if you do this in
the form of a screencast, but we'll take a textual step-by-step.

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Dec 31, 2009 at 10:31 UTC

Reinierz,

for an RCP project, the best thing I think it to import my "testrcp.zip" into
eclipse, and right click on the "testrcp.product" file Run As... -> Eclipse
application.

Ensure the following in the run configuration:

  • Main Tab -> "Run a product" must be set to TestRCP.product
  • Plugins Tab -> Add required Plugins

Hope that helps a little,

Christophe.

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Dec 31, 2009 at 10:31 UTC

๐Ÿ”— testrcp.zip

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Jan 02, 2010 at 17:27 UTC

I get this:

java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

I presume I don't have the right plugins for my eclipse.

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Jan 08, 2010 at 16:52 UTC

Strange, I can't tell what is wrong. I am using Eclipse 3.3, maybe that is why.

Do you have a more complete stack ?

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Jan 08, 2010 at 20:30 UTC

I forgot the 'add required plugins' bit.

Fixed that. Now, when I run it, I get 0 errors, along with a completely blank window containing absolutely
nothing. Its title is "TestRCP". I presume this means its working.

I'm running in lombok-edge, on eclipse 3.5.0.

@lombokissues
Collaborator

๐Ÿ‘ค christophe.moine ย  ๐Ÿ•— Jan 09, 2010 at 21:33 UTC

Yep, it works,

Can you export the plugin correctly ?

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Jan 10, 2010 at 00:01 UTC

Followed the instructions as per the actual bug report (top of this page). It took rather long for some reason
(nearly a minute), but it finished without complaints (I did have to go to the dependencies tab and hit 'add
required plugins'). I then went to the directory I specified, and ran the executable, which results in the same
thing: Completely blank window titled "TestRCP".

In other words, it all seems to work for me.

@lombokissues
Collaborator

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment