Teamcity Remote debug from Intellji IDEA
Unable to Remote debug In teamcity:
I have gradle project which I want to remotely debug in Teamcity. This gradle project is ui automation for an application.
I m using Intellji 14.1.7 & Teamcity 9.x .I have manually downloaded and installed TeamcityIntegration plugin.
I have TeamCity job with mutiple build steps. One of them is "Gradle runner type"(to build and run my groovy code).Using Gradle build step the tests are
executed successfully.
I added another build step "IntelliJ IDEA Project" as Runner Type for the same Job as a First Build Step.
Given JVM command line parameter:"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=****" and my Run configuration.
I haven't added "Path to the project". As per the comments it is mentioned to add ".idea" as path of the project, but my teamcity agent or my vcs don't have the .idea folder.
In IntelliJ IDEA,I added a run configuration :Application -> Intellji Project Build configuration and shared the same.
Given VM options:"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=****".
Remote run with my local changes is running successfully in the Teamcity agent.
But Remote debug is failing while building IntelliJ IDEA Project build step in the job in Teamcity with the below error
"Cannot find IntelliJ IDEA project files by specified path: "."Step IntelliJ IDEA Project failed with unexpected error"
What should be given as the Path to the project in the "IntelliJ IDEA Project" as Runner Type build step ?
Where to give the compile and run command (which is a Gradle Task)?
In IDEA Runconfiguration or
In IntelliJ IDEA Project Build Step
What should the correct Run/Debug configurations for the my project to run the groovy files
Please sign in to leave a comment.
Gradle and IntelliJ IDEA runners are two separate possibilities.
If you are going to use an IntelliJ IDEA runner, you need to store the .idea folder into VCS. IntelliJ stores most of the project properties in the .idea folder. If TeamCity doesn't have access to this folder, then it cannot identify the project properties and thus it cannot run the code.
If you want to run the gradle task, then you can simply run it as a gradle runner and you wouldn't need to put .idea in to the VCS. You can use multiple gradle runners as different steps / configurations, and have them run different tasks each, or configure multiple tasks in the same step. If you want to configure the gradle task in the IntelliJ IDEA project as a run configuration, and want the project step runner to run it as you have configured, then simply add the .idea to VCS, but it seems overcomplicated when you can simply add the gradle runner.
I hope this helps.
Will Remote debug work with below option.
"If you want to run the gradle task, then you can simply run it as a gradle runner and you wouldn't need to put .idea in to the VCS. You can use multiple gradle runners as different steps / configurations, and have them run different tasks each, or configure multiple tasks in the same step"
Adding .idea folder to VCS is not possible in our project so we tried with the below steps.
Remote debug with Gradle runner buils steps on TeamCity is not working with shared Gradle Run/Debug configuration from Intellji.
With Gradle run configuration "Remote debug on Teamcity" button is disabled.
Currently TeamCity plugin supports
for remote debug so we tried with Java application run configuration, But since our Teamcity Job donot have the Intellji runner build step we got the below error in IDEA.
So, Is there anyway to remote debug local files using only Gradle runner build steps without using Intellji Idea runner build step?
Hi,
sorry about the confusion. Gradle allows to remote debug projects, but not through our remote run plugin (https://discuss.gradle.org/t/how-do-you-attach-a-debugger-to-gradle-so-that-i-can-debug-it-running-a-task/7526). Further down that thread, it's explained how you can debug a gradle project with IntelliJ, but again, be mindful that this won't be hooked up directly through teamcity, it will just be a gradle process being debugged by intellij.
If you want to do it through the plugin, as the message states, it's only supported for "IntelliJ IDEA projects" steps. As mentioned, you need the .idea project added to version control for this runner to compile your project. The full folder is not fully required, but some files on it are required. In order to compile the project, link the modules/dependencies together, and even see the run configurations, the .idea folder needs to be present as they're stored there.
I hope this makes it clearer.
Regarding what you put in the build configuration, that will only work with IntelliJ, not with teamcity, unless you have the .idea folder in VCS. To run that in a gradle runner in teamcity, you will need to pass those values to the gradle JVM parameters in the teamcity configuration. To have that screen be useful in teamcity, you will need to add the .idea folder, then use the IntelliJ IDEA Project step.