I use IntelliJ Idea 14 Ultimate.
I have a multimodule project with a project/Build.scala. Here is the layout of my project.
- myproject
- module 1
- module 2
- project
- Build.scala
I try to use the native SBT from scala plugin. I choose Import project from external model and then select SBT. Then I select the root folder of my project and click on Finish.
But the project is not well imported. Libraries are downloaded but all imports are in red in submodules (cannot resolve).
So I have to use sbt gen-idea, that works fine, but I would be very happy to get rid of it …
I had the same problem (IDEA 14 Ultimate). This solve that after import.
File > Invalidate Caches / Restart...
Shown here
Related
Im trying to use a single Intellij IDEA window with multi projects (that are not related) imported.
The problem that I'm facing is when I'm executing a sbt task, the task is not loaded in the right project directory.
This is what I did (all in the Intellij Idea window):
Opened a root empty sbt project.
In the sbt toolbar, I clicked the + and added 2 projects job-service and user-service (each was its own build.sbt file)
Pressed Reimport All sbt projects just for fun
Executed compile (from the sbt toolbar) for the user-service
The sbt shell opened, and started compiling the empty root project:
[info] Set current project to root (in build file:/Users/dima/git/root/)
[IJ]sbt:root> compile
what I've expected is
[info] Set current project to user-service (in build file:/Users/dima/git/user-service/)
And of course, the same for the second project job-service
Versions:
Idea version: Version: 2019.2 Build: 192.5728.98
SBT version = 0.13.18
I know the way to use a single build.sbt file with multi projects. But those projects are not related. each project has its own build.sbt file.
I just want to use a single Idea window with multiple projects. and that the sbt toolbar could execute the tasks to the right project
Thanks!
EDIT:
This is the process to recreate what I'm facing:
open project named root2
Import another sbt project called learner
Compile the learner project from the sbt toolbar!
The Problem: sbt shell sets current project to root2
the same for publishLocal task. it sets the current project to root2 and publishes a root2 artifact.
what should have been, is that the sbt would set the current project to learner
I have this problem on IntelliJ some time ago, but in that moment my project was not sbt related. That project contains two different applications in different programming languages, so they could not have a common build file.
But I've found a solution to solve this problem which was using IntelliJ Modules. These Modules will let you create different projects inside your current workspace.
You can access it in File -> Project Structure... -> Modules (In the left panel)
I think you can use this feature to accomplish your expected result. Hope it helps!
I'm using eclipse mars and I'm working on a multi modules maven 2 project.
Since now it was always working fine when importing the project into eclispe.
My project structure is like
myproject
|-common
|-dao
|- ...
In each pom the artifact-id is
<artifactId>myproject-common</artifactId>
<artifactId>myproject-dao</artifactId>
...
What I always did till now
retrieve the project from svn
mvn clean install
mvn eclispe:eclipse
in eclipse import > existing project > browse to myproject and it displays the good project names : myproject-common, myproject-dao, ...
But since today the last step gives me the folder name in place of the artifact name : common, dao, ...
And after import, lot of errors saying eg. that Project 'dao' is missing required Java Project: 'myproject-common'
I don't understand. Same version of eclispe,maven and java than few months ago.
And after mvn eclipse:eclispe, the .project file is containing the good name
<projectDescription>
<name>myproject-common</name>
How can I solve that ?
I solved it by changing:
import > existing project
to:
Import -> Maven -> Existing Maven Projects
I'm using IntelliJ 13.1.2 on OS-X Mavericks.
I added a new dependency to my build.sbt inside an IntelliJ project. I synced my project as well as my build.sbt but I cannot import classes from this new library in my Scala classes.
However, when I do a sbt clean complile; sbt console on a terminal (outside of IntelliJ) I can successfully import classes from this new library.
Can anyone help me resolve this ?
Thanks
In preferences -> SBT (in Project Settings section) -> check the box next to 'Use auto-import' and that should keep IDEA synced with your build.sbt
I want to migrate our build from maven to SBT, so now I work separatedly on Build.scala file. However I don't benefit from any syntax highlighting (that is quite obvious, I don't have SBT in my classpath). What is the correct way to get SBT to my classpath, adding sbt-launch.jar does not seem to help.
IntelliJ 13 has built-in SBT support; if you're running a lower version, then you can have a look at their sbt plugin.
There's also an sbt plugin on github for generating idea project files. I've had success with running the gen-idea task it provides.
Run sbt gen-idea. It will create a "YOUR_PROJECT_NAME - build" project within your main project (for whatever your YOUR_PROJECT_NAME happens to be). Under the project folder of the build project, I was able to write a Build.scala with the following code:
import sbt._
object Build extends Build {
}
The SBT Build trait is recognized just fine. I'm running IntelliJ 13 build #IU-133-696, Scala plugin 0.30.378.
Eventually what I did is finished to write my build.sbt stub, and opened a project with it. Now everything seem to work.
I am trying to get a simple Akka program building with Eclipse and Scala. I used g8 to create the sbt project with Akka(g8 typesafehub/akka-scala-sbt) and then sbteclispe to create the Eclipse project. When I import the project into Eclipse I'm given errors saying I am missing Akka. Is there any way that I can build an Akka project with Eclipse?
The simplest thing is to add the sbteclipse plugin to your Sbt build. It automatically generates project files for Eclipse, so that you can import your project with all its settings, classpath included. To do so, add the following under project/plugins.sbt (not in the root of your project, but under the project subdirectory):
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
then, start sbt and at the prompt write eclipse. You should see:
> eclipse
[info] About to create Eclipse project files for your project(s).
[info] Successfully created Eclipse project files for project(s):
[info] Test Project
Then go to Eclipse and Import your project.
I use this to start the 1.x microkernel from the IDE, I think it came from Henke:
Main class : akka.kernel.Main
VM args:
-Xms256m -Xmx1024m -Dakka.home=./kernel -Dlogback.configurationFile=src/main/resources/logback.xml
In kernel directory I have a symlink config -> ../src/main/resources
In the kernel directory I also have an empty deploy directory. Not used, but must be there.