tibtof tibtof - 1 year ago 203
Groovy Question

Create a Java class from a groovy test file in IntelliJ

Trying to do TDD in a java project using groovy tests, I need to generate java classes on the fly (Alt

Enter from the test on the name of a class I want to introduce -> Create class -> Select the java main package as Target destination).

The problem is that, even if the Target destination is a java source directory, IntelliJ generates a groovy class.

Is there any way to quickly generate a Java class, instead?

Answer Source

With the current version of IntelliJ IDEA (2016.2.4) the only solution I found is to generate a groovy class (Alt+Enter| Create class from the test) and then convert it to Java (Refactor | Convert to Java).
To make it faster I also added a shortcut for Convert to Java: Ctrl+Shift+O was the best available option for me.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download