I have got IntelliJ 11. I use Maven for dependency management.
I want to create one module which contains Java and Scala source files. I have already added a folder "src/main/java" and "src/main/scala" under Project Settings => Module => "Module XYZ". The Scala facet is also added already.
What do I need to make IntelliJ compile both correctly?
Is it possible to mix Scala and Java code? Yes, there is the ability to mix both types of code. It is possible to create an SBT project, put Scala code in src/main/scala and java code in src/main/java in the same project and make it work.
Import a module from existing sourcesFrom the main menu, select File | New | Module from Existing Sources. Select the directory in which your sources, libraries, and other assets are located and click Open.
In the Project tool window, right-click the project folder and select New | Module. Alternatively, from the main menu, select File| New | Module to open the New Module wizard. If you used main menu to add a module then the process of adding a module is the same as Creating a new Maven project.
I did not find a good Google result first. Got it working now. This site explains it very clearly:
http://devnet.jetbrains.net/thread/290032
To create a new project that uses Scala:
To add a new module that uses Scala into existing project:
To add Scala support to existing module:
To manually configure existing module:
Create library "scala-compiler":
Classes:
Create library "scala-library":
Classes:
Sources:
Docs: /doc/scala-devel-docs/api/
(if you downloaded Scala as an archive, you need to get separate API docs archive and extract it so that \doc\scala-devel-docs\api exist; if you installed Scala using LzPack, then API docs are already there)
Hints:
Source: Project-configuration-explained
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With