I want to add one extra sbt shell in the IJ. How to do it?
I want to run some sbt commands inside a two different SBT Shells.
An easy solution is to run one SBT in the sbt shell and the second in a terminal. You can run a terminal inside of the IDE by using menu View | Tool Windows | Terminal - see Terminal in the IDEA Help. When you open a terminal, it is opened with a project directory as a current directory. You type sbt and you have another sbt running for your project.
This second SBT has some limitations compared to a SBT shell:
you cannot navigate to errors and warnings by clicking on them
the SBT will not reload when you press Reload SBT in the IDE
Still, depending on what you want, it might provide a working solution.
Related
What steps are needed to configure the IntelliJ debugger to attach to scala Play tests managed by sbt?
In IntelliJ 2019, you can attach the debugger to the sbt run command using the debug button in the sbt shell with no configuration changes.
However, the debugger does not attach to the test command.
Consider attaching the debugger via IntelliJ's sbt shell:
In the sbt projects tool window select checkbox Use sbt shell for builds
Open sbt shell tool window (usually found at the bottom)
Click Attach debugger to sbt shell button (the icon looks like a bug)
In the status bar it should say Connected to the target VM (see the image bellow)
Set breakpoints in your test
Execute test command in the sbt shell tool window
Debug sbt shell window should open and execution should stop at the first breakpoint.
Note if you are using Play like OP, then by default Play runs tests in forked JVM, so for the above technique to work try setting Test / fork := false in build.sbt.
First, you need to run your SBT with -jvm-debug [port] like:
sbt -jvm-debug 5005
Then open dialog Run/Debug Configuration and click on Remote.
On the newly created configuration set up the correct host and port (usually localhost and 5005) and click on apply.
Then when you'll just need to run this configuration and set up breakpoints. After that just run test inside SBT console.
When I want to run my .mas2j file in Eclipse, I always have to right click the file and then select "Run as Jason application". Is there a way to add a shortcut to do this?
Jason's "Run" button should be added to eclipse toolbar ("Step 14" of jason eclipse-plugin installation guide) and it is supposed to work. Anyway, you can save some time using shell, following instructions in jason's github page:
git clone https://github.com/jason-lang/jason.git
cd jason
gradle config
And run a project using a command like bellow:
jason examples/gold-miners-II/miners.mas2j
Another way, and actually my recommendation is moving to JaCaMo (which has Jason embedded). JaCaMo offers a gradle script for your projects. You can easily download JaCaMo from the repository and create a project from zero in one shot (first, go to your project root folder and then type):
curl -s -O http://jacamo.sourceforge.net/nps/np07.gradle
gradle -b np07.gradle --console=plain
After downloading JaCaMo, the script will ask you to type a name for your project, for instance, "test". So, go to "test" folder and type:
gradle run
The just created JaCaMo project should launch after this command. Besides good compiling performance, another advantage is that gradle will manage package dependencies.
This is usually the issue with uncategorized commands in Eclipse. I had the same issue with the Run JaCaMo Application option. In order to see all your plugin commands:
Go to Preferences -> General -> Keys. Click on Filters... and de-select Filter uncategorized commands then Ok.
Then you should be able to find the desired command in the Command list and add a preferred Binding.
Note: If Eclipse offers a command, it should be listed in the pop-up window that appears when hitting the Show a table of all available commands button of the Oomph toolbar. The table shows all the available commands, where you can find them, and all the defined shortcut keys.
I'm using sbt 1.0.4 (latest as of this writing), and running sbt console brings me into the Scala REPL (project uses Scala 2.12.4). What is the keyboard command to invoke code completion? Tab does not work for me, it just adds a tab character and backspace is broken successively. I'm starting sbt from Bash in Linux.
Such that Indexe<key> -> IndexedSeq, for example.
There is a related question. So there is a bug that affects sbt console, but one can just run sbt and then from the sbt prompt enter console, and then Tab works as expected.
This question may sound silly for you, but I have been searching the Internet for a while and couldn't find the answer. How can I open SBT Tool Window in Intellij (scala and SBT plugins obviously installed)?
In Menu: View -> Tool Windows there should be two entries:
SBT
SBT Console
The first you can use to refresh IDEA project structure from SBT and view dependencies.
The second gives you a console where you can run sbt commands.
Update:
As Justin already aded:
As of IntelliJ IDEA 2017.1 Build #IC-171.3780.52 there is a new and (imho) better way:
(If you are working with an SBT project, that is)
When you open the SBT Tool Window, you will find a new scala terminal icon:
This will open an sbt console session with your sbt project import settings.
One major benefit is that you will actually (finally) get links to your code lines for compiler warnings and errors.
To be able to open SBT Console from View -> Tool Windows you first need to install the plugin required for it.
You can find the SBT plugin by searching for it under Settings -> Plugins -> Browse repositories
Plugin homepage: https://github.com/orfjackal/idea-sbt-plugin
In IntelliJ 2017.1, an sbt shell is integrated with the Scala plugin. You can open it from an icon on the sbt project view toolwindow, or from the "Tools" menu
In Intellij 16 SBT Console menu item no longer exists and in Debian 7 (XFCE) Alt-F12 doesn't work.
To run SBT console:
select View -> Tool Windows -> Terminal (for Alt-F12)
type sbt and console works
You can either use above or simply use Alt+F12
I had an issue where the sbt shell launcher was not on the bottom of the IDE and the sbt was not listed as an option under Tools. Discovered that the issue was after expanding a zip file of a scala project to my workspace, the build.sbt file was not in the root folder of the project structure, but nested one subfolder down. When importing this project into intellij it was not properly configuring it as an sbt project. After removing the project, exploding the zip in such a way that the build.sbt was in the root of the project and reimporting the issue was resolved.
I had a similar, but slightly different issue. First, I didn't have the Scala plugin installed on my version of IntelliJ. Once done, I restarted the app. Then created a new project (even though I was trying to open an existing one). When creating the project I made sure to put the root directory of the project as the root folder of the project I wanted to import (the one that has the sbt file). IntelliJ synched my new project with the existing one and I was good to go.
I am using a the NetBeans 7.x IDE. I have a Netbeans Application module. I use the Build and the Run buttons from the IDE. The module runs just fine when I press Run Project or F6 button. I like to run
this from the command line. Since everything was build automatically for
me I have no idea where things are or how to run it. There are several jar files in the project/build/public-package-jars. Is there a way to see what command and options the Run Project is using ?
Go to the root of the application (or wherever there is a build.xml file) on the command line and run ant -p. That will list all of the available options for building and running the application.