Get null use System.getenv() in gradle - intellij-idea

def CATALINA_HOME = System.getenv("CATALINA_HOME")
task t << {
println CATALINA_HOME
}
CATALINA_HOME is null when I run with idea (double click t from Gradle Project panel), but when gradle t is executed in terminal I get a correct path.
It seem this is only happen in OSX (my version is 10.11.14 El Capitan).

IntelliJ IDEA has problems with recognizing environment variables on OS X (not sure if on other systems as well). Please have a look at this post - it should solve the problem (some time ago I had similar issue and found it very useful).
Since the linked page no longer exists you can find it in the archive here. Thanks #AlexeyStepanov!

Want to add, that sometimes it insufficient for Intellij Idea to configure Run/Debug Configuration option of Environment variable.
Instead you need to set them in File -> Settings -> Build, Execution, Deployment -> Build Tools -> Runner -> Environment variables

Related

Could not delete caches dir when compile Kotlin in Intellij IDE

My project use plugin kapt to generate mapper.
When run app then can not compile Kotlin (image below)
If remove plugin kapt then it not happend.
To resolve I must restart Intellij IDE. Take more time.
This error probably only happen on windows
This is a Kotlin bug, you can vote and watch it for updates: https://youtrack.jetbrains.com/issue/KT-36253. A workaround is to kill the running Java processes.
I have this problem almost every build (Android Studio stable + Artic Fox).
Manual Solution (try this first, if it works continue)
Task manager > Processes > End "OpenJDK Platform Library" tasks
(sometimes it's standalone, sometimes it's under "Android Studio")
OR
Task manager > Details > End "java.exe" tasks
Automated Solution
Create a new end-java.bat file
Content of .bat file: taskkill /f /IM java.exe
Right click end-java.bat file > create shortcut
Right click the shortcut > properties
Add shortcut key (e.g. ALT + CTRL + 1)
ALT + CTRL + 1 will now fix the issue
Try This :
https://developer.android.com/studio/build/build-cache
Add this code :
// To re-enable the build cache, either delete the following
// line or set the property to 'true'.
android.enableBuildCache=false
After that clean project and restart android studio
Also you can try to use a different JDK (e.g. OpenJDK). It helped me.
File -> Project Structure -> SDK Locations -> JDK Location
You can reboot the system, it will help. But this problem will return soon. This is the bag of Android Studio 4.2 https://youtrack.jetbrains.com/issue/KT-36253

Sigasi in Eclipse

I have just installed the Sigasi Studio pluginin Eclipse (version: Eclipse IDE 2018-12). When I try to launch it,to make a new VHDL file, I get the following:
The selected wizard could not be started. org/eclipse/lsp4j/Range
(occurred in com.sigasi.hdt.vhdl.ui.VhdlExecutableExtensionFactory)
org/eclipse/lsp4j/Range
How I could solve it, please?
Thank you in advance.
Thanks to the Sigasi support, I was able to solve the problem. They wrote me:
The lsp4j plugin version is to recent for the xtext version that ships
with Sigasi Studio 4.2. This issue has been resolved in the preview
channel of release 4.3. Therefore - if you wish to use the plugin
version of Sigasi Studio - I recommend to install the 4.3 preview
following the steps explained on
http://insights.sigasi.com/tech/preview.html.
That's all. Now, I would like to configure Sigasi with GHDL (as a compiler, when I run the project) and GTKWAVE (ad a waves viewer). How can I do that?
Thanks in advance.
SIGASI + GHDL + GTKWAVE (all in one)
It is very powerful combo that you can set up. ATTENTION i use macOS 10.13.6:
Step 1
Make sure you have both installed GHDL and GTKWAVE typing
$ which gtkwave
/usr/local/bin/gtkwave
$ which ghdl
/usr/local/bin/ghdl
Step 2
Open Sigasi an make new Project and create an additional compile.sh file with:
#!/bin/sh
PROJECT_NAME="PWM_Generator"
PROJECT_NAME_TB="PWM_Generator_tb"
WORKING_DIR="/Users/imeksbank/Dropbox/UMHDL"
/usr/local/bin/ghdl -a --workdir=$WORKING_DIR/work.ghdl $WORKING_DIR/$PROJECT_NAME/$PROJECT_NAME.vhd;
/usr/local/bin/ghdl -a --workdir=$WORKING_DIR/work.ghdl $WORKING_DIR/$PROJECT_NAME/$PROJECT_NAME_TB.vhd;
/usr/local/bin/ghdl -e --workdir=$WORKING_DIR/work.ghdl $PROJECT_NAME_TB;
/usr/local/bin/ghdl -r --workdir=$WORKING_DIR/work.ghdl $PROJECT_NAME_TB --vcd=$WORKING_DIR/$PROJECT_NAME/simulation.vcd;
now, be aware, for each project you create your own variables like
PROJECT_NAME
PROJECT_NAME_TB
WORKING_DIR
I use always Dropbox for such approach because then i can access via Windows as well.
And of course, there is a possibility to create custom variables in Sigasi -> External Tool Configurator -> Program -> compile_sh -> environment to pass them to make compile.sh independent. Here you have to deal with it by yourself =)
Step 3 .
Set up you External Tools Configurations to let shell script be executed by Sigasi Studio and create the .vcd file for gtkwave:
Click on currently created Project (in my case it is the PWM_Generator).
After that click on Run -> External Tools -> External Tools Configurations ....
Then go to the left sidebar and under Program create your own anchor like compile_sh.
Finally you have your route :
Program
--compile_sh
And now extend this anchor by a custom created shell script :
Main->Location gets ${workspace_loc:/PWM_Generator/compile.sh}
Main->Working Directory gets ${workspace_loc:/PWM_Generator}
Click Apply and Run and that's it !!! After this you can program VHDL / Verilog and compile via Run -> External Tools -> compile_sh having created .vcd. In your project appears the gtkwave file and there just double click and it starts. =)

PlayFramework 2.4.x ide debug

Is that possible to debug in playframework 2.4.x ? (x = 3 in my case) ?
IntelliJ IDEA 14.1.5
I'm following this link/doc: https://www.playframework.com/documentation/2.4.x/IDE
Create a new Run Configuration – From the main menu, select Run ->
Edit Configurations Click on the + to add a new configuration From the
list of configurations, choose “SBT Task” In the “tasks” input box,
simply put “run” Apply changes and select OK. Now you can choose “Run”
from the main Run menu and run your application
You can easily start a debugger session for a Play application using
default Run/Debug Configuration settings.
No luck so far for IntelliJ IDEA. When run as / press debug it does not drop me to debug break-poitns in IDE in my controller code when I got my get/post requests.
UPDATE:
One more try with same result (see screenshot) with adding play2 debug configuration (following: https://www.jetbrains.com/idea/help/getting-started-with-play-2-x.html):
If I change 2.4.3 to 2.4.2:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3")
or in: addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.4.3")
same result.Or if I put JVML levelt to java 7.
It will be hard to convince a team to migrate a project from tomcat to play :) No out-of-the box magic.
And that "Setting up Play fork run ... " massage in logs that eats all processors for many seconds makes it even harder.
Something weired happanes anyhow.
Inititally I have createad my project from Play Activator as typical scala-play project.
But now when I created it from IDE New->Project->Scala->Play 2.x, then it works with debugging on out of the box.
If one figures out what is difference would be nice (even if that guy is me, from the Future). Seems guys from JetBrains care more about IDE integratiion than guys from TypeSafe ;).
Maybe the reason is in plugins.sbt
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")
that what my IDE uses by default.
Or maybe it has somethign to do with this routing and IoC
For now I'm suttisfied. Thinking that 2.4.x is not ready to be used (at least not in convicing someone in something).
Update
Comment the following out and breakpoints work again:
addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.4.6")

Debugging SBT project with Play in IntelliJ IDEA

I have a SBT project
in this project i have a sub play project and other projects
example from my build file :
lazy val subProj1 = Project(id = "sub-proj-1", base = file("sub1"))
.settings(...)...
lazy val subProjPlay = play.Project("play-proj", 1.0 , path = file("web"))
need to debug the play server from IntelliJ IDEA.
To run the project I use sbt run on the command line.
How can I debug the project in IDEA?
I found this to be the easiest solution : (using IntelliJ IDEA )
in IntelliJ :
Go to "edit run configurations"
Create a new remote configuration (port 9999, all other details leave with default values)
Go back to IntelliJ and run the new debug configuration (don't forget to put a break point)
From command line run :
sbt -jvm-debug 9999 run
The easiest solution.
Edit Configurations... -> add SBT Task (not Remote task).
Specify SBT Task: ~run.
Run created SBT Task using - Debug button
Provided you've Play distribution installed locally, use play debug run on the command line and connect to localhost on the port 9999 in IDEA.
From Debugging section in Using the Play console in the official Play 2.2.x documentation:
You can ask Play to start a JPDA debug port when starting the console.
You can then connect using Java debugger. Use the play debug command
to do that
If however you don't have it (and for a reason don't want to install it), add Remote Run configuration in IDEA that will give you a hint for the command line arguments you should be using when launching SBT, e.g.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
When you launch SBT that may or may not be as simple as launching SBT jar, just use the above to configure JVM to run in debug mode.
IntelliJ IDEA 2016.1.1 && Play Framework 2.5.3
For me, no matter how I set(create new Run/Debug Configuration for Play 2 App or SBT Task, specify the debug port, execute in Run or Debug mode) in the IntelliJ IDEA 2016.1.1 Enterprise Edtion, the IDEA can not open the debug port(default 9999), so the debug is impossible.
After disable the sbt-fork-run-plugin(comment it in /project/paly-fork-run.sbt), it works!!!
I am newer to Play framework,and have found many bugs...Compare to RoR, it's so hard to learn, to run, to use, to debug...
Below is my steps:
disable the sbt-fork-run-plugin(comment it in /project/paly-fork-run.sbt)
execute activator -jvm-debug 9999 "run 11111" (I use port 9999 to debug, port 11111 to run my Play project)
In IDEA, add an new Run/Debug configuration, Choose, set debug port to 9999
debug the new created configutation

Is it possible to launch more than one Webstorm instance using the command-line launcher?

Webstorm can be launched from the command line using the command wstorm. However, would it be possible to launch more than one instance? Usually, the second time I run wstorm, it doesn't open another Webstorm for me and does nothing.
In OS X, this is apparently caused by an outdated wstorm (a Python script at /usr/local/bin/wstorm). I verified the solution indicated in this ticket with WebStorm 2016.1.3:
Go to Tools > Create Command-line Launcher....
UPDATE Nov-2016: As of WebStorm 2016.3, the default name of the launcher changed from wstorm to webstorm. If you prefer wstorm instead, make sure to edit the script name before clicking OK:
Just run:
WebStorm.exe "Full\path\to\the\project\that\contains\the\.idea\folder\of\your\project"
The project will run in the same instance but in a separted window as described here: https://www.jetbrains.com/webstorm/help/opening-multiple-projects.html
NOTE: This was tested on WebStorm 9.0.3 and may not work on previous versions.