codepleb
codepleb

Reputation: 10581

Transform a java project into a scala project (Intellij)

I have a gradle project written in Java and want to turn the whole thing into a scala project (still gradle). Which steps are necessary to do so?

Since java code should be fully supported in scala, this shouldn't be to hard. I tried it, but I cannot write scala code within my code now.

I started defining the main method in scala and it seems like Intellij has no idea what I try to do.

What I did so far:

Do I need to define another "project sdk"?

Upvotes: 3

Views: 2048

Answers (2)

Alexey Romanov
Alexey Romanov

Reputation: 170919

First, try if it compiles in Gradle from command line (gradle compile). Based on what you say, it should; if it doesn't, fix this first.

If it does, add Scala plugin in IDEA (if it isn't already installed) and you may need to activate Scala support explicitly as mentioned in @0__'s comment.

Upvotes: 0

vvg
vvg

Reputation: 6395

As I understand you have issues with compiling scala code witnin new project (rec-imported).

Do you have scala-library as dependency in your project? If not, you can add Global library to Project structure.

Upvotes: 1

Related Questions