This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Issues with building the plugin

1 reply
Ben Jackman
Joined: 2009-02-04,
User offline. Last seen 42 years 45 weeks ago.

I think I am pretty close to building the plugin, however I am having a few
issues that I cannot resolve. I apologize in advance if I am doing anything
really stupid and for the length of this email.

Basically the scala-plugin project is not seeing the output of the
scala-plugin-aspects project. This is resulting in numerous errors where the
scala-plugin cannot find certain classes it needs from the
scala-plugin-aspects project.

So i get a bunch of errors like this:
not found: type ScalaCompletionProcessor
not found: type ScalaEditor
... etc

I am not exactly sure how it wires together as I am new to plugin
development with eclipse, however i did notice that the scala-plugin-aspects
project is not putting anything into its "bin" directory and I know that
this is typically where an eclipse plugin will drop all of it's code. I have
tried eclipse -clean and closing re-opening, cleaning everything several
times, and also scala-plugin does not list scala-plugin-aspects as a project
dependency.

So what i did do was to manually run the target build in the
scala-plugin-aspects build.xml file, then i added it's output dir
scala-plugin-aspects/build as a class folder in the project settings of
scala-plugin.

This leaves me with no errors so i can now run the plugin as described on
the hacking page the plugin page (having setup that config.ini stuff).
however during the run the scala-plugin-aspects build target i get numerous
warnings like:

[iajc]
/somedirectory/lamp/scala-plugin-aspects/src/scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/ScalaEditorPreferencesAspect.aj:63:0::0
this affected type is not exposed to the weaver:
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor (needed for
privileged access) [Xlint:typeNotExposedToWeaver]
[iajc] warning at installTabsToSpacesConverter();

[iajc] warning at
/somedirectory/lamp/scala-plugin-aspects/src/scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/ScalaEditorPreferencesAspect.aj:32::0
advice defined in
scala.tools.eclipse.contribution.weaving.jdt.ui.javaeditor.ScalaEditorPreferencesAspect
has not been applied [Xlint:adviceDidNotMatch]
[iajc] warning at
/somedirectorylamp/scala-plugin-aspects/src/scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/SaveParticipantRegistryAspect.aj:24::0
advice defined in
scala.tools.eclipse.contribution.weaving.jdt.ui.javaeditor.SaveParticipantRegistryAspect
has not been applied [Xlint:adviceDidNotMatch]

when i then start my run i get the following errors in the console:

SEVERE: register definition failed
java.lang.RuntimeException: Cannot register non aspect:
scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
,
scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect

...

[org.eclipse.jdt.core] warning register definition failed --
(RuntimeException) Cannot register non aspect:
scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
,
scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
Cannot register non aspect:
scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
,
scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
java.lang.RuntimeException: Cannot register non aspect:
scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
,
scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect

[org.eclipse.equinox.weaving.aspectj] info not weaving bundle
'org.eclipse.jdt.core'

and so finally when i try to open a scala file in the plugin that I am
running (it still starts up despite the errors in the console) i get the a
window with an error message instead:

Could not open the editor: The editor class could not be instantiated. This
usually indicates a missing no-arg constructor or that the editor's class
name was mistyped in plugin.xml.
under details >>
java.lang.NoClassDefFoundError:
scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/ScalaEditor
...

Just for fun I tried adding a no-args constructor and recompiling the
scala-plugin-aspects jar however it had the same error I am suspecting that
it has more to do with aspectj not running properly

I also noticed that in the scala-plugin/build.xml file under the
devel.prep task there is no entry for scala.plugin.aspects.dir
whereas there are entries for scala.plugin.aspects.dir under both
devel.clean and devel.dist

I should also note that I am running on 64 bit fedora, and I am importing
the projects into the workspace without copying them, i am not sure if this
ends up causing any other problems, i will try copying them right into the
eclipse workspace folder. instead of using import existing project.

Ben Jackman
Joined: 2009-02-04,
User offline. Last seen 42 years 45 weeks ago.
Re: Issues with building the plugin

Ok so I was doing something really stupid, I missed the part about installing
the AJDT plugin from the guide.
(https://lampsvn.epfl.ch/trac/scala/wiki/EclipsePlugin)

After I installed that everything seems to be ok.

Ben Jackman wrote:
>
> I think I am pretty close to building the plugin, however I am having a
> few issues that I cannot resolve. I apologize in advance if I am doing
> anything really stupid and for the length of this email.
>
> Basically the scala-plugin project is not seeing the output of the
> scala-plugin-aspects project. This is resulting in numerous errors where
> the scala-plugin cannot find certain classes it needs from the
> scala-plugin-aspects project.
>
> So i get a bunch of errors like this:
> not found: type ScalaCompletionProcessor
> not found: type ScalaEditor
> ... etc
>
> I am not exactly sure how it wires together as I am new to plugin
> development with eclipse, however i did notice that the
> scala-plugin-aspects project is not putting anything into its "bin"
> directory and I know that this is typically where an eclipse plugin will
> drop all of it's code. I have tried eclipse -clean and closing re-opening,
> cleaning everything several times, and also scala-plugin does not list
> scala-plugin-aspects as a project dependency.
>
> So what i did do was to manually run the target build in the
> scala-plugin-aspects build.xml file, then i added it's output dir
> scala-plugin-aspects/build as a class folder in the project settings of
> scala-plugin.
>
> This leaves me with no errors so i can now run the plugin as described on
> the hacking page the plugin page (having setup that config.ini stuff).
> however during the run the scala-plugin-aspects build target i get
> numerous warnings like:
>
> [iajc]
> /somedirectory/lamp/scala-plugin-aspects/src/scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/ScalaEditorPreferencesAspect.aj:63:0::0
> this affected type is not exposed to the weaver:
> org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor (needed for
> privileged access) [Xlint:typeNotExposedToWeaver]
> [iajc] warning at installTabsToSpacesConverter();
>
> [iajc] warning at
> /somedirectory/lamp/scala-plugin-aspects/src/scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/ScalaEditorPreferencesAspect.aj:32::0
> advice defined in
> scala.tools.eclipse.contribution.weaving.jdt.ui.javaeditor.ScalaEditorPreferencesAspect
> has not been applied [Xlint:adviceDidNotMatch]
> [iajc] warning at
> /somedirectorylamp/scala-plugin-aspects/src/scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/SaveParticipantRegistryAspect.aj:24::0
> advice defined in
> scala.tools.eclipse.contribution.weaving.jdt.ui.javaeditor.SaveParticipantRegistryAspect
> has not been applied [Xlint:adviceDidNotMatch]
>
> when i then start my run i get the following errors in the console:
>
> SEVERE: register definition failed
> java.lang.RuntimeException: Cannot register non aspect:
> scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
> ,
> scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
>
> ...
>
> [org.eclipse.jdt.core] warning register definition failed --
> (RuntimeException) Cannot register non aspect:
> scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
> ,
> scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
> Cannot register non aspect:
> scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
> ,
> scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
> java.lang.RuntimeException: Cannot register non aspect:
> scala$tools$eclipse$contribution$weaving$jdt$builderoptions$ScalaJavaBuilderAspect
> ,
> scala.tools.eclipse.contribution.weaving.jdt.builderoptions.ScalaJavaBuilderAspect
>
> [org.eclipse.equinox.weaving.aspectj] info not weaving bundle
> 'org.eclipse.jdt.core'
>
>
> and so finally when i try to open a scala file in the plugin that I am
> running (it still starts up despite the errors in the console) i get the a
> window with an error message instead:
>
> Could not open the editor: The editor class could not be instantiated.
> This usually indicates a missing no-arg constructor or that the editor's
> class name was mistyped in plugin.xml.
> under details >>
> java.lang.NoClassDefFoundError:
> scala/tools/eclipse/contribution/weaving/jdt/ui/javaeditor/ScalaEditor
> ...
>
> Just for fun I tried adding a no-args constructor and recompiling the
> scala-plugin-aspects jar however it had the same error I am suspecting
> that it has more to do with aspectj not running properly
>
> I also noticed that in the scala-plugin/build.xml file under the
> devel.prep task there is no entry for scala.plugin.aspects.dir
> whereas there are entries for scala.plugin.aspects.dir under both
> devel.clean and devel.dist
>
> I should also note that I am running on 64 bit fedora, and I am importing
> the projects into the workspace without copying them, i am not sure if
> this ends up causing any other problems, i will try copying them right
> into the eclipse workspace folder. instead of using import existing
> project.
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland