23. June 2014

How to debug Gradle script

First of all: do not use daemon mode for debugging.

IntelliJ Idea is automatically spawning daemon when you start any Gradle task. You have to attach to remote process.

I wrote┬ásmall “How to debug” based on info from forums.gradle.org.

You’ll need to set GRADLE_OPTS environment variable to:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

Here is example in PowerShell:

01-command-line-options

$env:GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

Configure Remote debugging in Idea:

02-configure-remote

You do not need to change anything in default configuration.

Now return to command line with your project and invoke task. Gradle will automatically stop and it waits for debugger.

03-start-process

Attach debugger

04-attach-to-process

Here we go ­čÖé

05-break-point

There is small limitation. You can stop code execution outside DSL e.g. in class method (line 3). You won’t be able to stop execution in Gradle DSL line 10.

You can download sample build script from Github.

6. January 2014

IntelliJ Idea – Cordova – Default Activity not found! – solution

Situation: import Cordova project with support of Android platform to Intellij Idea. You’re not able to start emulator, because of strange error:

Default Activity not found!

cordova-error-activity-not-found

One solution could be: go to File menu and choose Invalidate Caches /Restart.

This might not help.

The real problem is most likely in configuration of Android module. Open project configuration, select module and make sure that directory src is marked as Source.

cordova-error-add-sources

Confirm module configuration and error message should disappear.

2. February 2013

IntelliJ Idea must have plugin – Key promoter

Reading through document with keyboard shortcuts for IDE is boring and often you do not have time to learn it.

Dmitry Kashin wrote simple yet powerfull plugin for IntelliJ Idea – Key Promoter.

It simply displays keyboard shortcuts whenever it is possible to speed up your work.

keypromoter

31. December 2012

Syntax highlight does not work in IntelliJ Idea for .jade – solution

Jade Templating Engine is popular in Node.js world. There is also plugin for IntelliJ Idea which has support this format.

If you open .jade file in Idea and there is no syntax highlight then there is something wrong.

Most common mistake is that people open .jade file before installing plugin and they choose Text editor to open this file. Idea remembers this decision and after installing plugin it will always open .jade files in basic Text editor without syntax highlight.

Correction is quite easy. You need to fix file extension association.

Open Settings – Editor – File Types. Find Jade and add *.jade file extension.

idea-jade

23. August 2012

IntelliJ Idea – How to enable zoom of text by CTRL + Mouse wheel

You can zoom-in or out text in editor window of IntelliJ idea (PyCharm) by CTRL + Mouse wheel.

The only problem is that this feature is disabled by default. You have to turn it on.

Press CTRL + Alt + S (Settings) and type: “change font size” into text search field. Select: Editor and check option “Change font size (Zoom) with Ctrl+Mouse Wheel”