How to run thucydides maven project in debug mode - eclipse

I created Thucydides project from thucydides-jbehave-plugin archetype.
I found that to run stories it can be used mvn command "verify thucydides:aggregate"
But what if I need to debug some step adding a breakpoint in appropriate line.
I tried to run "thucydides:aggregate -Dmaven.failsafe.debug verify" in eclipse maven configuration but got error "unable to install breakpoint in ..." and so failed to debug because class source code is not readable;
What is the correct command or other way to debug story with breakpoints?
Regards

add parametes in
Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5005,suspend=y
and in you eclipse use remote debug.
You need start you application and when you see message that it wait connection, start remote debug.

Related

I just installed Eclipse, can't seem to get it to work

I'm very new to programming. But I started out with Eclipse after I couldn't seem to get CodeBlocks to function properly. Now when I installed it, and ran it for the first time (started an empty project and all), an error message was displayed
Building Workspace has encountered a problem. Errors occurred during the build.
I got curious and clicked on details, which showed
Errors occurred during the build.
Errors running builder 'CDT Builder' on project 'Rand1'.
java.lang.NullPointerException.
I got a screenshot of the situation tagged to the post
Here
You can try the following:
run eclipse.exe with the -clean parameter. to do this either navigate to where you installed eclipse and go to properties on eclipse.exe and add -clean in the end of the parameter
run it via command. i recommend you to run via command so that it wont be a permenant thing whenever you start eclipse

Sonar Eclipse issue

I am having some issues running Sonar analysis in Eclipse. I have Java Maven project with Groovy Spock unit tests.
mvn sonar:sonar
Works fine and generates reports which I can see on the "localhost:9000".
However I need to see issues in Eclipse. I have done the Configure->Associate... and now when I choose "SonarQube->Analyze" I get following errors in the console:
10:18:23.892 ERROR - Invalid value of sonar.libraries for com.otpp.email:bulkemail-downloader
Exception in thread "main" org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41)
at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59)
Caused by: java.lang.IllegalStateException: No files nor directories matching 'C:\Program Files\springsource\ggts-3.4.0.RELEASE\plugins\org.codehaus.groovy_2.0.7.xx-20130828-1400-e43-RELEASE\plugin_dsld_support\' in directory C:\Users\SHEVELD\workspace\bulkEmailDownloader
at org.sonar.batch.scan.DefaultProjectBootstrapper.validateDirectories(DefaultProjectBootstrapper.java:343)
and Eclipse also shows error pop-up with following details:
Error during execution of Sonar
Error status [command: C:\Program Files\Java\jdk1.7.0_45\jre\bin\java.exe -Dsonar.exclusions=file:**/fixtures/** -Dsonar.buildbreaker.skip=true -cp C:\Users\SHEVELD\AppData\Local\Temp\sonar-runner-impl8294792314646586115.jar org.sonar.runner.impl.BatchLauncherMain C:\Users\SHEVELD\AppData\Local\Temp\sonar-project5418432264915204295.properties]: 1
From all this codes I understand that there is some issue with sonar-eclipse-groovy triangle.
Any hint is greatly appreciated!
Edit _________________
I reinstalled the GGTS into a non-shared folder (aka "C:\tools" and not "C:\Program Files"). Sonar plugin ran an analysis using my local server. However it stopped working upon switching to a remote server.
Actually it worked with a local Sonar server for a bit. Now, when I switched to a remote Sonar server it again gives me the same error.
Additionally I tried Installing Groovy plugin on the regular Kepler Eclipse and after doing that Sonar stopped working...
Removing Groovy DSL jar from the classpath solves the problem, but is pretty useless solution.
They created ticket for this issue:
https://jira.codehaus.org/browse/SONARIDE-430
after my question:
How can I file an issue for SonarQube Eclipse plugin
I would like to post this as a comment, but as mys reputation is lower 50 i can't do so...
1.) Checkthe following: In Eclipse go to "window --> preferences" and take a look if an entry for "SonarQube" exists or not.
1b.) If not go "Help --> Eclipse Marktplace" and search for SonarQube and install the plugin. Restart Eclipse now. Follow the instuctions in 1.)
2.) Click on SonarQube entry and then choose the Servers entry
3.) As default a Server is registered here already, but you can delete him. Click on "add" on the right side and fill in your data. Click "Test Connection" to make sure your settings are correct.
EDIT: Checked it on my own projects: I getting a "Unable to contact SonarQube server". Try to run the project as maven build within eclipse and use "sonar:sonar" as command. (Have you installed the Maven-Plugin in Eclipse?)

How to repeatedly run Wicket/Maven/Jetty project in Eclipse?

Thanks to those info http://www.ralfebert.de/blog/wicket/wicket_eclipse_setup/ and How can I begin using Wicket? now I am able to edit Java code and html files with Eclipse, and run it to get Jetty started.
However there are still two problems which do not allow me to repeatedly run the project:
I have to stop previous run in order to run it again
unlike regular Java project, where I could simply choose "run", now I have to go into "Run Configuration", select Maven Build type, and below select my project to run, and then finally click "run"
ad.1. How to make Eclipse stop the previous run on next run -- i.e. I would like to just run project, and Eclipse should either run it, or stop previous one and run it again
ad.2. how to "bind" Run/Run to running my configuration (Maven Build / my project)?
Thank you in advance for help.
Another simply option is to use a Start class with a main that runs and embedded jetty. Then you will be able to run and debug your application as a normal desktop java application with your IDE.
Check the example start file that comes with the wicket quickstart here:
https://github.com/jordeu/wicket/blob/master/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java

Debug Playframework in Eclipse

I just moved from Netbeans to Eclipse. In Netbeans, I can debug Playframework applications out of the box. However, in Eclipse, it seems hard to configure this in order to debug a web app (a Playframework app in specific).
As in Play! documentation,
The main launcher in only usable with the Run As eclipse command. You
can then use the “Connect JPDA launcher” using “Debug As” to start a
debugging session at any time. Stopping the debugging session will not
stop the server.
However, I can not see “Connect JPDA launcher” in "Debug As" (I'm using Eclipse Classic 3.7.0).
I've searched about JPDA (I'm new to Java and don't know about "main launcher" and JPDA, then config Remote Debug as instruct in
http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html
But it's returning an error:
Failed to connect to remote VM. Connection refused. Connection
refused: connect
I've searched and found some suggestions like:
1.)editing catalina.bat and adding the lines : set
JPDA_TRANSPORT=dt_socket ... set JPDA_ADDRESS=8000 AND
2.)Editing startup.bat call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
Actually I don't clearly understand this and I guess it's for configuring Tomcat. However, I'm using Play! default server, checked the application.conf and sure that it's listening to port 9000 and 8000 for JPDA.
Of course, I have started the Play app before debugging, I can access the app via port 9000 normally. I'm using Win 7 with no admin rights.
Do you have a detailed guide on debugging Play! in Eclipse?
As of Play 2.0, the eclipse folder and launchers are no longer generated when you run play eclipsify. After running play eclipsify, you can debug your project in Eclipse as follows:
In a console outside of eclipse, run play debug run.
In Eclipse, right-click your project, then choose Debug As -> Debug Configurations...
Right-click Remote Java Application, then click New.
The host should already be set to localhost. Set the port to 9999 (the default port used by the play debug run command).
Click Apply to save, then Debug to connect to your running Play instance.
First of all, you have created the configuration files for Eclipse by using the play eclipsify YourProject command, right? (If not, see Play framework documentation for more information.)
After that, you should have a folder named eclipse in your project. In it, you should see commands Connect JDPA to YourProject.launch, YourProject.launch and Test YourProject.launch.
Right-click on the YourProject.launch and choose Run As --> YourProject from the pop-up menu. That will start your application. When the application is running, right-click on the Connect JDPA to YourProject.launch, and choose Debug As --> Connect JDPA to YourProject.launch from the pop-up menu. That will start a debug session on your application.
Play 2.1-RC2 : Running Play! app that is synced with Eclipse
To make the project Eclipse compatible, got he project folder and then give command
">play eclipse". Now you can add it as an existing project form eclipse.
Then to run it you have to first run start play in the project folder i.e. command "play"
This will activate play server and identify the app in the project i.e. [appname]$
now you have to just give the command "run" to see your app running on the localhost:9000 or whichever port config you have specified.
Debug mode: To run this similarly you need first give command "play" then [appname]$ "play debug run" this will by default use port 9999 so when you go to localhost:9000 in your browser and in your eclipse file -> Debug As -> Debug configuration.. -> New Remote Java Application -> connect specify port 9999 and debug
With activator, you'll need activator -jvm-debug <port number> ~run
I guess most of you are running the play framework with Typesafe Activator. If you are doing so, This may help you,
activator -jvm-debug ~run
Like : activator -jvm-debug 9999 ~run
(then It will start the debugger in 9999 port along with the app running in 9000 port.)
Now go to eclipse and right click on the project name you want to debug and select Debug As -> Debug configuration.. -> (select)Remote Java Application -> new (top left an icon with tiny plus sign) -> connect specify port 9999 and debug.
As of Play 2.1.2, I was getting the 'address in use' error when running play debug run.
The fix was to edit play.bat in play-2.1.2 directory and change these two lines:
:setDebug
set JPDA_PORT=9999
to
:setDebug
set JPDA_PORT=8551
Then in Eclipse, select Debug Configurations, find "Remote Java Application", do New. Then set port to 8551. Now you can start play using
play debug run
And then in Eclipse start debugging using the debug configuration you created about.
If you run "play eclipsify" on the project folder, it will create two run configurations.
Looking at the run configuration details, you should check if the following line (or something similar) is in the "VM arguments":
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
-Dplay.debug=yes
-Dplay.id=test -Dapplication.path="${project_loc:NMKServer}"
-Djava.endorsed.dirs="c:\Java\play-1.2.2/framework/endorsed"
-javaagent:"c:\Java\play-1.2.2/framework/play-1.2.2.jar"
Here you can configure the debugging port. With this config, I can attach to process using the instructuctions you have.

How to execute or implement batch file in java project with eclipse

Is it possible to implement or extract batch file in eclipse and debug java project in debug mode. Because without batch file I can't debugging my project and can't set breakpoint.Or some another solution. How to debug my application with use .bat file to start my java project.
Is it possible to implement or extract batch file in eclipse and debug java project in debug mode.
Hmm... You can do everything you do with a batch file (assuming you're using it to start a Java program of course) from Eclipse with a Run > Run Configuration... (also available from the contextual menu after a right-click or via the top toolbar).
Because without batch file I can't debugging my project and can't set breakpoint.
Why?! I don't think this is true.
Or some another solution.
Start your class/project in debug mode using Run > Debug (reusing or creating a new Run > Debug Configuration...). Again, this is also available from the contextual menu after a right-click or via the top toolbar.
How to debug my application with use .bat file to start my java project.
To be fully exhaustive, you can run an external program from Eclipse using an Run > External Tools > External Tools Configuration.... And you could indeed use remote debugging options and connect a remote debugger from Eclipse. But honestly, I don't think you need that.
Maybe you should explain what you're trying to do more precisely.
Try remote debugging. Eclipse can attach to remote Java processes, but the Java program must be started with special keys. I don't remember them, google/help for your service.