IntelliJ IDEA: Running a shell script as a Run/Debug Configuration - intellij-idea

Is there a way by which a shell script can be invoked from IntelliJ Run/Debug configurations?

I just found out that we can invoke a shell script with the help of BashSupport plugin.

'Add External tool' in the 'Before Launch' does the trick.
Screenshot

IntelliJ IDEA 2019.2 update
New version of IntelliJ IDEA has Shell Script Support included. It means you can now create Shell Script build for your project.
Edit Configurations > (+) Add New Configuration > Shell Script
You can also build your project before executing your script by adding Run Another Configuration task. That's how it looks like: Add Shell Build window

Not sure about 11, but in 12 there's a part of Run/Debug Configuration that is called "Before Launch" and you can select your shell script in "Add External tool" option.

Related

run a maven plugin goal with parameter in intiliji idea

I'm using the liquibase maven plugin to run and rollback the migrations.
I'm running the rollback goal using the command line as follows:
mvn liquibase:rollback -Dliquibase.rollbackCount=1
How to edit the configuration in intiliji idea to run the goal with the given parameter.
I'm using the intellij idea version : 2021.3.2
You need to create a custom Run Configuration for that, here is how to do it: Run/Debug Configuration: Maven
You'll basically need to
From the main menu, select Add Configuration.
Name you configuration and provide the command and parameters.
Done! Now you just need to select it from the dropdown menu of run configurations and execute it.

Run CMD/Powershell command before the build command?

How I can run a CMD/Powershell before my Java GUI Application will be build and invoked.
I want run the command: sass ANYFILE.scss:ANYFILE.css to compile my scss file first.
In the Run/Debug Configurations I found nothing which helps me at the Before launch option.
Add the External Tool in IDE which will run any command you want, then add it in Before launch section.
There is a PowerShell plugin that provides a run configuration to run powershell scripts. You can add it as Before launch option as well.

Use custom script in Intelij IDEA to run sbt shell

Is it possible to run sbt shell in Intelij IDEA using custom script instead of built in sbt or sbt from sbt-launch.jar? Why I need this, for example there is some project which uses custom script to set config file location, VM parameters, and other options for sbt and this script is shared in version control system. And it would be very convenient to just specify for IntelliJ IDEA location of such script.
This is currently not possible. However, to pass project-specific sbt command line parameters to sbt you may place a .sbtopts in your project directory, and likewise a .jvmopts for VM parameters.

How do I run a EXE Go executable from within IntelliJ IDEA?

I have a Go program which I'm working on in IntelliJ IDEA on a Windows machine. The program's structure is a little unconventional (don't want to go into detail here as its besides the point) because of which I first have to compile the program using the following command:
go build -o cli.exe
And then I can run cli.exe directly in the command prompt.
But how do I configure the run configuration in IntelliJ IDEA so that it doesn't mind running a Windows executable ? Because if I try to tell it to run an EXE file as it's run configuration, it gives me error "Main file is invalid"
How do I solve this ?
Make sure you have a file name (not a folder name) in field File on Run/Debug Configuration window (In IntelliJ IDEA go to menu Run->Edit Configuration...->your_configuration). That was my case.
You may be able to install the Bash plugin on Windows, then create a run configuration using the Bash plugin, and just run your executable from a script.
Create a Go Application run configuration and that should work. You can choose to run either a file or a package. If you would share more details then the answer would be more complete. If you still have an issue with this, please open an issue to the bug tracker and I'll be able to help out (please follow the issue template there).

How to run sbt-assembly tasks from within IntelliJ IDEA?

Is it possible to run sbt-assembly from within IntelliJ IDEA?
Also I read in the doc that one could add task within the SBT Tool window. But what I see is that it only helps you view your project not task? I cannot add any tasks there. How does the Tool window work exactly?
I have the last version of IntelliJ IDEA.
You can find the SBT plugin useful for your needs. With it, you can execute any tasks or command available in your build so sbt-assembly ones should work, too.
The plugin gives you SBT Console in which you start a sbt shell as if you were running it on the command line. The plugin gives you a more IDEA-like environment to work with the interactive console.
This answer is now out-of-date.
IntelliJ now allows you to create a run configuration for an SBT task. You create the Run Configuration by :
choosing "Edit configurations" from the "Run" menu (or the toolbar
popup)
click the "+" button to add a configuration and select
"SBT Task" as the type of configuration you want to make.
fill out the details such as the name of the task and the
working directory if necessary
You can now run the task in the same way as any other run configuration; select it in the run configuration popup in the toolbar and click the run button (or if you're one of those keyboard-only people press shift-ctrl-r and select the task from the popup that appears)
official documentation here : https://www.jetbrains.com/help/idea/2016.2/run-debug-configuration-sbt-task.html