Mixed Scala/Java projects not working correctly

0 views
Skip to first unread message

Boris Terzic

unread,
Jun 30, 2009, 5:06:16 PM6/30/09
to scala-netbeans
Hi All,

Environment: Linux Ubuntu Jaunty 64 bit, Netbeans 6.7, Sun JDK
1.6.0_13

Scala kit plugin installed from
http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz
as referenced on http://wiki.netbeans.org/Scala#section-Scala-2.AdventureWithNetBeansNightlyBuild
(which BTW is rather confusing: as far as I can tell I have an
identical version to what was posted on Caoyuan's Blog as the v1
plugin. It shows up as Scala Kit 0.15.0 in the Netbeans plugin
manager.

I have a Maven based project, using the Maven scala plugin (Maven
2.1.0).

The project is mixed Java and Scala and I'm going back and forth, I
have a src/main/java and src/main/scala directory.

Using Java from Scala works fine: Java classes are detected and auto-
completed by the plugin.

Using Scala from Java does not work: that is, I can compile my project
without errors using Maven but the plugin does not seem to recognize
any of the Scala packages and classes from within Java code.

Is this known? Anything I can do about it? Am I using the wrong
version?

Cheers,
Boris

Caoyuan

unread,
Jun 30, 2009, 10:21:48 PM6/30/09
to scala-n...@googlegroups.com
On Wed, Jul 1, 2009 at 5:06 AM, Boris Terzic<aggr...@gmail.com> wrote:
>
> Hi All,
>
> Environment: Linux Ubuntu Jaunty 64 bit, Netbeans 6.7, Sun JDK
> 1.6.0_13
>
> Scala kit plugin installed from
> http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz
> as referenced on http://wiki.netbeans.org/Scala#section-Scala-2.AdventureWithNetBeansNightlyBuild
> (which BTW is rather confusing: as far as I can tell I have an
> identical version to what was posted on Caoyuan's Blog as the v1
> plugin. It shows up as Scala Kit 0.15.0 in the Netbeans plugin
> manager.

Scala feature is bundled with a coupe of plugins, each one has its own
version number. And, recently, from NetBeans 6.0, 6.5 to 6.7, the
underlying architecture changes rapidly, and not compatible with each
other, thus I have to maintain different branch for each NetBeans
release, and change the version number naming rule to relate to
NetBeans version. So just forget about the version number from module
names. I have a plan to maintain a AutoUpdate center for Scala/Erlang
plugins, and will got all these modules version to work for upgrade
aware.

>
> I have a Maven based project, using the Maven scala plugin (Maven
> 2.1.0).
>
> The project is mixed Java and Scala and I'm going back and forth, I
> have a src/main/java and src/main/scala directory.
>
> Using Java from Scala works fine: Java classes are detected and auto-
> completed by the plugin.
>
> Using Scala from Java does not work: that is, I can compile my project
> without errors using Maven but the plugin does not seem to recognize
> any of the Scala packages and classes from within Java code.

That's the issue when Java/Scala code are mixed in same project. The
editor can aware Java code from Scala, but not vice versus until I
implement a Scala->Java Mapping, it's not a easy work, I've evaluated
some prototype work, and need more carefully thinking about it, for
performance and timesheet.

Currently, the best way is to separate Java/Scala code to different
projects. For Maven project, it should work almost smoothly, but you
need to run "mvn install" after source code modified, to reflect the
changes aware for the other projects, the behavior may depend on maven
plugin for NetBeans, I will do some detailed testing and improvement
when I have time, even co-work with the maven plugin developers.


Cheers,
-Caoyuan

Boris Terzic

unread,
Jul 7, 2009, 1:52:22 PM7/7/09
to scala-n...@googlegroups.com
Hi Caoyuan,

Thanks for the quick answer!

[...]

NetBeans version. So just forget about the version number from module
names. I have a plan to maintain a AutoUpdate center for Scala/Erlang
plugins, and will got all these modules version to work for upgrade
aware.

Looking forward to it!
 
That's the issue when Java/Scala code are mixed in same project. The
editor can aware Java code from Scala, but not vice versus until I
implement a Scala->Java Mapping, it's not a easy work, I've evaluated
some prototype work, and need more carefully thinking about it, for
performance and timesheet.

I'm not sure I could help, but is the source code for the plugin available somewhere?
 
Currently, the best way is to separate Java/Scala code to different
projects.

Okay, I'm splitting it up.
 
For Maven project, it should work almost smoothly, but you
need to run "mvn install" after source code modified, to reflect the
changes aware for the other projects, the behavior may depend on maven
plugin for NetBeans, I will do some detailed testing and improvement
when I have time, even co-work with the maven plugin developers.

The split worked fine, and indeed since we go through the Maven repository I need to "install" after doing changes but that's okay. 

The remaining problem I have is that even going through the split, with the Java module now depending on the Scala module, Netbeans will still not correctly identify the Scala classes: I get source errors for each package/class I try to import from the Scala module into the Java module. Building with Maven works fine though. Inspecting the jar files also works and shows that the classes seem to be present in the right places. Is this another artifact of the plugin in Netbeans?

Cheers,
Boris
Reply all
Reply to author
Forward
0 new messages