Intellij Idea add Scala support to existing Java project - java

Intellij Idea add Scala support to existing Java project.
Just cannot figure it out How to add Scala worksheet to existing Java project?
It would be just nice to have Scala REPL or worksheet.
But after resiarsh and trying I failed to do that.

To add Scala support to existing module:
Right-click the module in Project View, choose “Add Framework Support…”
Check “Scala” in technologies list (unavailable if module has Scala facet attached)
Provide a path to Scala installation (if not detected)
From http://blog.jetbrains.com/scala/2010/09/02/project-configuration-explained/.

Related

How to reference classes from a Maven project in Eclipse 2019-09?

Using Eclipse 2019-09, my goal is to use OpenPDF library, but first, I need to be able to debug its code a bit when calling from my test project.
I have created a workspace where I have created a simple java program that would open a PDF.
I have cloned the OpenPDF repo, and I have added the projects to Eclipse. They are Maven projects.
Now, I need to setup the relation between the projects, in order to use OpenPDF code.
I've read here that I should add openpdf project to the Projects in Java Build Path of my test project, but that is not clear. If I add the openpdf project to the Classpath entry there, it's not compiling because it does not find the openpdf project classes.
So, what is the right setup? (I am not asking how to refer a library through Maven and I don't intend to build a signed Maven library).

Tell intelliJ to compile module with scalac in a java project?

I have a java project in intelliJ and I've added a few modules, one of which has scala code in it.
I want to tell intelliJ to compile this module with scalac not javac, but I can't figure out where to configure it, and when I try to compile it gives me this error, "Cannot create instance of scalac"
Per https://intellij-support.jetbrains.com/hc/en-us/community/posts/206001829-Project-configuration-explained:
A module that requires compiling with Scalac should have a Scala facet attached.
And further down (what I think you want):
To add Scala support to existing module:
Right-click the module in Project View, choose "Add Framework Support..."
Check "Scala" in technologies list (unavailable if module has Scala facet attached)
Provide a path to Scala installation (if not detected)

STS - Scala project not showing up

I have installed Scala IDE plugins from Eclipse Marketplace but there is no option to create Scala project.
NOTE:
I am using spring-tool-suite-3.6.2.RELEASE-e4.4.1
Installed Scala IDE for Eclipse & Scala Worksheet since JDT Weaving is already installed in STS.
Scala version: 2.11.2
Create a regular project then when you right click on it in the package explorer there should be a Scala sub menu and you can "add Scala nature". Now STS knows it's a Scala project.

Compiling Groovy Code in my Java EE application

My web project includes Groovy class files.
How should I compile it for my project using Eclipse?
Rest of my team is using IntelliIDEA to use it but I want to set it up in Eclipse.
To start with I have installed a Groovy Plug-In for my Eclipse and installed Groovy on my Windows.
You should be able to right click on the project -> Configure -> Convert to Groovy project.
If your project is a maven project, then you should also install m2eclipse as well as the optional m2eclipse configurator for groovy-eclipse. This will automatically configure your project for Eclipse and groovy.
Hope this links helps you. It has step by step on how to import your existing Groovy Project into eclipse so you can work on it.
http://docs.codehaus.org/display/GROOVY/Create+Your+First+Groovy+Project
If the project is created using grails create project, I believe all of the .project and .setting files are there for eclipse.
If you have the groovy eclipse plugin installed you should be able to mix your groovy classes into the same packages as your java code. Are you using maven or ant to build your actual war file? If not you will have to make sure that you compile the groovy classes along with the java code. while in eclipse you will be fine. Both ant and maven have facilities for compiling the groovy and java code together for your actual war that you deploy.

Introducing scala into existing netbeans java project

I have an existing java project in Netbeans. I would like to start coding parts of it in Scala. I can add ".scala" files to the project but apparently they aren't compiled.
Can I somehow modify the existing Netbeans project settings in order to build java and scala sources together or do I need to create a new project and import the existing (java) sources?
Thanks
Martin
EDIT Sorry, I forgot to mention: I've installed the Scala-Plugin for netbeans, so compiling scala code is feasible.
I can create a new (Scala) project and add both scala and java sources to it and it compiles perfectly. My question was if (and how) it's possible to migrate an existing "java-only" project towards such a "mixed" project.
I don't think this is possible in the way you want it. You could however write an Ant build-script and let Netbeans execute it when building you application.
Otherwise I suggest to just create a new scala project and import it as *.jar library into your Java application. This keeps your project clean and nicely modularized.
You will need to migrate to use something like Maven to do this for you, as Netbeans doesn't know how to compile Scala code. Maven can be configured to compile the .scala files first then the .java, resulting in your final compiled source.
Have a look here for the maven config.
I would recommend doing a new maven project, Project form Archetype, and use the following.
http://mvnrepository.com/artifact/org.scala-tools.archetypes/scala-archetype-simple/1.3
This basically auto imports you a project all set up to get started running scala in a Java project.

Categories

Resources