score:4
Randall Schulz has asked the right question in the comment: "Why does it matter which tool does the compilation?" Up until now I believed that IDEA needs to compile all classes itself if you want to use its nice features (like IDEA's Scala Console or running tests from within it). I was wrong.
In fact, IDEA will pick up classes compiled by any other tool (like the great SBT for instance). You just need to assure that all classes are up-to-date before using any of IDEA's helpful features. The best way to do it is:
- launch continuous incremental compilation in the background (for example by issuing "~ compile" in SBT)
- remove "make" step in IDEA's run configurations
That's all! You can then use all cool features of IDEA (not only syntax highlighting and code completion, but all auto-imports in Scala Console, quickly running selected unit tests) without switching between different windows. That's the workflow I missed until now! Thanks to everybody for all the comments about the issue.
score:0
You should look at using a dependency management suite like Apache Ivy or Apache Maven. Then put your Java source in a separate artifact, and have your Scala project be dependent on the Java project artifact.
If you go the Maven route, there is a Scala plugin.
score:0
Probably the simplest way to get compiled Scala and Java files is SBT - Simple Build Tool. Just create a project (+ add dependencies and so on) and compile it. Scala + Java compilation works out of the box. I've switched to SBT from Maven.
If you have a complex POM or if you have another reason not to migrate to SBT, you can try to configure the POM. Just adding (and possibly configuring) the Scala plugin should be enough. I hope it will not break the Java support.
Source: stackoverflow.com
Related Query
- How to make IntelliJ IDEA use javac for Java and scalac for Scala?
- How to use Scala in IntelliJ IDEA (or: why is it so difficult to get a working IDE for Scala)?
- How to set up Java and Scala in one single Module in Intellij IDEA 11?
- How to make Scala Power Pack for IntelliJ Idea to work?
- How can I use scala sources from a different location in a sbt project and also make it work with IntelliJ IDEA?
- How can I use IntelliJ IDEA 10.5.2 to connect to a database for a Scala application
- How to use IntelliJ with Play Framework and Scala
- How do I get Intellij IDEA 12.0 to work with Play Framework 2.1.0 app and Scala 2.10.0?
- How to know if a Scala file modified with IntelliJ Idea is saved and if it is checked into CVS?
- How do I make intellij Idea to highlight Scala script correctly with #! (shebang)
- How to configure IntelliJ to use short package names on "Optimize imports" for a scala codebase?
- How to synchronize Intellij and sbt builds for a scala project
- How to configure code style for Scala in IntelliJ IDEA
- scalac v javac and scala v java
- IntelliJ Idea debugger's evaluator gives different results than normal program for comparing Scala Long and Float variables
- How to generate Scala setters and getters with IntelliJ IDEA
- How do I create horizontal or vertical struts and glue for use with scala BoxPanel?
- In Scala 2.8, how to write (append) a line to a file? Should I use Java clesses or there are native Scala functions for this?
- Intellij Idea - what configuration to use for Scala
- How to make IntelliJ scala project use Scala 2.9.2 version?
- How to write this for iteration in scala without using the For( loop; if condition) and still use yield properlly
- How to work with Intellij Idea and Scala
- How do I use scala collection methods to make a method for correlation coefficient?
- Scala code compiles through command-line sbt but fails when compiled through Intellij Idea - how set up Intellij to use external sbt?
- How can i visualize and see the execution in intellij for any scala recursion question?
- How to use Scala plugin for IntelliJ on Debian?
- How can I use the Scala REPL to test java code - java and scala REPL giving different outputs
- How to use gradle and IntelliJ to build a scala project?
- How to use scala list and java list in the same file in scala code base?
- What exact class does Java use for arrays and how to instantiate it in Scala?
More Query from same tag
- How to import implicit classes through nested contexts
- How to print all the columns of a Matrix
- InvalidUseOfMatchersException when I am passing any string for my mock parameter
- Can you provide scala view bounds from Java?
- What does "=>" mean in Scala?
- Play not answering HTTP requests
- What is wrong with the following inheritance/mix in in Scala?
- unable to override a method in Scala
- scala: finish actor's loop
- Akka Streams: Why does the GraphDSL.Builder have to be marked as implicit?
- Does Scala having an interpreter give Scala projects the option to execute them either compiled or interpreted?
- Cassandra spark connector data loss
- Akka Http Server - How to have route respond with byte array binary response
- Spark Dataset - map option[T] fields
- Alternative pattern matching with variable binding?
- Inserting Dataframe Data into RDD
- Remove event Listener in scala.js
- How to drop nested column or filter nested column in scala
- Why is trivial implicit not found?
- Scala delegate import of implicit conversions
- Restrict specific type in Scala paramaters?
- Is this Scala code correct?
- could not find implicit value for FromRecord
- What do WARN messages mean when starting spark-shell?
- Invoking curried function
- scala lower and upper bounds
- Error: Could not find or load main class com.sparkarma.spark.WordCount
- Spark Structured Streaming not restarting at Kafka offsets
- Shark getting started: all queries hanging
- Scala syntax which I don't understand