Add JVM parameter to sbt shell configuration in IntelliJ - intellij-idea

I have to set an additional library path -Djava.library.path=/x/y/z in order to execute run / debug tasks using SBT, otherwise I get a NoClassDefFoundError. Where can I do this in IntelliJ IDEA?

You could add additional parameters in "Settings | Build... | Build Tools | sbt"

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.

How to not use gradle in IntelliJ to execute Kotlin main

I created a simple Kotlin project with the Console template in IntelliJ and running it I am getting the gradle-symbol in the run-toolwindow (cf. picture).
Usually I see in other tutorials that there is the Kotlin symbol so no gradle is used to run the main of the Kotlin-project.
Is there any possibility to change the way to run a Kotlin-main (despite the run configurations, which I took a look at, but did not find a way to change the "run-environment")
I tried the solution:
CTRL + ALT + S to enter Settings > Build, Execution, Deployment > Build Tools > Gradle, switching Build and run using to IntelliJ IDEA, then getting the problem:
Which is closer, but now it seems to get a problem as in Java, what I thought in Kotlin is no problem to have different file names then the actual code-content of the file.
As described in Configure the build and run actions topic use Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Build and run using: option and switch it to IntelliJ IDEA:
CTRL + ALT + S to enter Settings then in the left panel choose Build, Execution, Deployment > Build Tools > Gradle, find Build and run using and pick IntelliJ IDEA

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.

Make IntelliJ IDEA run JUnit tests with -parameters javac option

Is there a way to ensure the -parameters option is passed whenever running JUnit tests from IntelliJ IDEA?
If it's impossible to set globally, it would even help to set it for specific Run/Debug configurations.
The -parameters option is a Java compiler option, so it affects how the code is compiled, not how it is run. You can add it in Settings | Build, Execution, Deployment | Compiler | Java Compiler | Additional command line parameters.
Yes, you can do it that's way :

How to make IntelliJ to clean output artifact directory before deploy?

In Run/Debug configuration there is no option to select clean in section Before launch. How to make run configuration so IntelliJ 12 would clean output directory before deploying there?
In the menubar select Build -> BuildArtifacts -> All Artifacts -> Clean
First, open File | Settings | Compiler then ensure that Clear output directory on rebuild is enabled. Then hit Alt+B,r to rebuild your project.
edit: If you really want to rebuild before each launch, you can create a custom ant script and invoke it before launch, like so.
In addition to answer by #reviteja. I also found following solution to this problem
In the corresponding run/debug configuration, add the Build
artifact task to the Before launch task list. The
artifact will be built automatically when you execute the run/debug
configuration (Run | Run or Run | Debug).
from here