sbt with intellij: debug mode doesnt work - intellij-idea

I am trying to debug a sbt application in intellij, but somehow break points are not hit.
My steps:
On terminal, run:
sbt -jvm-debug 5005
Then create debug configuration:
Then hit debug button:
And finally run the app:
sbt:raptor> run
Application does run well, but none of the debug points are hit.
What am I missing here?

If it remains on the latest version of the IDE, please submit the issue in https://youtrack.jetbrains.com/issues/SCL .

Related

Run as Groovy Script

After years of working fine, for the last few months I've not had the ability to Run As Groovy Script.
I can select it from the menu, but nothing happens.
Today I installed the latest Eclipse and plugin in an attempt to fix, but no luck.
What went wrong? Is there a log file to check?
https://dist.springsource.org/release/GRECLIPSE/3.8.0/e4.16
The output of the launch is written to the Console view. If there was a problem launching you can check the Error Log view for an entry. The launch configuration under Run > Run Configurations... > Groovy Script may also reveal classpath or other issues.

Debugging individual protractor files with WebStorm

I want to be able to right click on an individual protractor test, click debug or run and have it execute. I can do this from the command line but I want to be able to debug with WebStorm to leverage the debugger.
By default when right clicking and debugging a file webstorm runs:
runnerw.exe "C:\Program Files\nodejs\node.exe"
--debug-brk=57698 --nolazy myspec.js
Can I have it run the following substituting the filename which I've selected:
node node_modules\protractor\bin\protractor protractor.dev.conf.js
--specs "/specs/myspec.js"
As a crappy work around I have the following:
This runs a single file but I need to edit the configuration each time to change the spec i'm testing.
protractor.dev.conf.js --specs "myproject/specs/test0043.js"
Does WebStorm allow you to dynamically substitute the test file?
Thanks
Can I do have it run the following substituting the file I've selected:
node node_modules\protractor\bin\protractor protractor.dev.conf.js
--specs "/specs/myspec.js"
and can you run the same not using WebStorm (in command line)? If you can, it's not a problem to do the same in webstorm
try ddescribe and iit
iit('should ...')
Will run only those tests marked with iit.
ddescribe will only run the tests under that suite(s)
Try the ddescriber plugin http://plugins.jetbrains.com/plugin/7233?pr=phpStorm

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

How to debug a maven goal with intellij idea?

Can you debug a maven goal with Intellij IDEA? I know that I can right-click and run Debug. However, the maven plugin does not appear in my External Libraries list, so I can not go into the code and set a breakpoint. Thus, Debug runs through the goals without stopping, like Run does.
I am using OS X 10.8 and IDEA 12.0.2.
EDIT: Goal
I've written custom specRunner for https://github.com/searls/jasmine-maven-plugin - However, $specs$ stays empty. So I try to see which files are actually loaded.
Figured it out:
from the command line, run maven goal with mvnDebug instead of mvn. E.g. mvnDebug clean
Open the source of the maven plugin you want to debug in intelliJ and set a breakPoint
In IDEA, add a Remote JVM Debug Configuration.
Under Settings, set Transport: Socket, Debugger Mode: Attach, Host: localhost, Port: 8000 (default port of mvnDebug).
Run the Configuration in Debug mode. It should connect to the waiting mvnDebug jvm.
Very easy. I am using Intellj Idea 15.0.4
Set the breakpoint in your maven plugin
In the tag "Maven Projects" go to the project witch is using your maven plugin.
In "Plugins" find your plugin and over the goal right click and Debug
Here is a screenshot:
Old question, but I was having the same need and it took me a while to get it to work. Hopefully can help someone.
For test debugging use:
mvn <goal> -Dmaven.surefire.debug
or
mvn <goal> -Dmaven.failsafe.debug
When execution stops and listens to socket at address 5005 (default) you run your configured remote debugger.
How to configure it:
Run -> Edit configurations -> Remote
Transport: socket
Debugger mode: Attach
Port: 5005 (default)
-> Save.
I think the easiest solution is to temporarily add the maven plugin as a dependency. Once this is done, IntelliJ will treat this just like any other dependency and you can set breakpoints the usual way.
The easiest way to debug maven goal ONLY within IntelliJ is to create a regular maven goal and in the runner tab pass those VM options:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
Where 8000 is a port number for remote debugging.
Then create new Remote configuration with port 8000. Run this configuration after running maven goal.
No need to setup up Java Remote Debugger or anything like that. It is literally just a right click -> debug on the Maven goal now, as explained in the official docs.
Either You can refer to above answer Or just add this plugin to pom.xml
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug -
Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
</jvmArguments>
</configuration>
</plugin>
And run maven goal with mvn instead of mvnDebug. E.g. mvn spring-boot:run
In IDEA, add a Remote Configuration.
Under Settings, set Transport: Socket, Debugger Mode: Attach, Host: localhost, Port: 8000 (default port of mvnDebug).
Run as Debug in IDEA , whenever you want to debug the code.
Since you are working with Intellij, there is already a built-in debugger there and you do not need to necessarily use mvnDebug which is a command line tool. Check out this tutorial: How to Debug Maven Applications in Intellij IDEA.
The tutorial uses the Maven Exec Plugin and lets you debug the application without a need to use the command line or MvnDebug. Thought sharing it might be of value here.
#Peter Szanto 's answer work for me, but I don't like mess my source code.
And I can't make those MvnDebug way work.
So I try another way, add plugin source as IDEA module.
Here is the detail step:
Clone the plugin source as an independent project.
In your project, go to File -> New -> Module from Exist Sources and add the plugin project you clone in step 1.
Now you can open the plugin source code and set some break point.
Run your maven goal as debug mode, it should stop at the break point.

All tests did not finish - xcode 4.5

When i try to run the unit test for my projects, i get test succeeded. But in the log navigator i get warning saying 'All tests did not finish'. But the same code works fine in another machine and all tests succeeds without any warning. I searched for other posts related this and tried everything, but nothing works for me. And also all of a sudden some unit-tests fail without any reason, but succeeds when i run it again. I even tried resetting the simulator, nothing works.
Any suggestions?
Try this... open a Terminal in your project's folder and type the following:
xcodebuild -list
If you have Unit Tests in your project you should see at least two targets: ProjectName and ProjectNameTests.
Now type the following command (note: you will need quotes around the ProjectNameTests if it has spaces):
xcodebuild -target ProjectNameTests build
You will almost certainly see something like the following towards the end of the output:
/Applications/Xcode.app/Contents/Developer/Tools/RunUnitTests:68: note: RunUnitTests exited without running tests because TEST_AFTER_BUILD was set to NO.
You can fix this in Xcode by selecting your project in the Project Navigator (Cmd-1), selecting your ProjectNameTests target, selecting Build Settings and scrolling down to the Unit Testing section. Change the Test After Build setting from No to Yes and type Cmd-U to run your Unit Tests again. This time it should work.
Hope this helps!
Looks like you get this warning if you are using OCMOCK and you try to mock 'self'. Once i changed this, it fixed my problem.