what are the differences in IntelliJ vs. eclipse regarding groovy development - eclipse

I am new to IntelliJ coming from Eclipse(mainly Java) and I am trying to find out what Groovy features are included in one IDE that are missing in the other.
Example:
Eclipse shows error in package explorer and in file when package import is incomplete
import Specification --> import spock.lang.Specification
Eclipse shows package mismatch error in package explorer and in file when package name is incorrect to directory structure.
IntelliJ highlights class own methods/properties in code completion in bold eclipse does not.
I would like to gather informations about both IDEs regarding groovy support. This is not about which IDE is better but what are the differences.

I have been using idea for groovy development for very long time and its support is great.
Among the little details I know and like:
Idea spock support permit to:
-- indent the "given:", "when:", and other "then:" labels which is great.
-- you can even have then "colorized as other groovy keywords with the spock plugin"
-- idea also indent recognize the data driven column title as variable for the spec code and indent this tables
-- and idea also support creation of new specification with the "navigate to test" shortcut. "Ctrl+Shift+T"
Idea also support logger generated by ats like "#Log"

Related

Generating JavaDoc for JUnit test classes works in Eclipse but not Intellij

So I am currently creating test classes (JUnit5) for my program. I seem to be running into an issue when trying to generate the JavaDoc html through IntelliJ, but generating with Eclipse for the exact same class works just fine.The error I get from IntelliJ is vague to say the least: "error: No public or protected classes found to document."
The little information I could find about generating JavaDoc for JUnit classes seems to be 10 years old at least and not quite helpful.Has anyone experienced a similar issue, and if yes any hints as to what I'm doing wrong?
Generated JavaDoc with Eclipse (same project, same POM) works fine but IntelliJ throws and error.
When you use the IDE main menu Tools | Generate JavaDoc to generate the JavaDoc, you could change the Visibility level to private, and the IDEA should able to generate the JavaDoc for your tests now.
If your tests' classes don't have any public/protected modifier using another protected visibility level will fail.

Error on opening the Apache Spark source code in IntelliJ IDEA

I’m trying to open the Apache Spark source code in IntelliJ IDEA.
I opened pom.xml on the Spark source code root directory.
Project tree is displayed in the Project tool window.
But, when I open a source file, say org.apache.spark.deploy.yarn.ClientBase.scala, a lot of red marks shows on the editor scroll bar. It is the ‘Cannot resolve symbol’ error. Even it cannot resolve StringOps.format.
How can I fix it?
On File | Project Structure window, the following error message is displayed with pink background:
Library ‘Maven: org.scala-lang:scala-compiler-bundle:2.10.4’ is not used
Can it be a hint?
The versions I’m using are as follows:
OS: Windows 7
IntelliJ IDEA: 13.1.6
Scala plugin: 0.41.2
Spark source code: 1.1.1 (with a few file modified by me)
I’ve tried to fix this and error state changed somewhat, but eventually I gave up fixing it on my own (with googling) and deleted .idea folder and started over. So now I’m seeing the errors described above.
UPDATE:
I noticed thw following popup:
Maven projects need to be imported: Import Changes Enable Auto-Import
And enabled auto-import according to the articles IntelliJ: Maven projects need to be imported: Import Changes Enable Auto-Import and http://javafortesters.blogspot.kr/2013/09/do-enable-auto-import-in-intellij-for.html . Now IntelliJ resolves base Scala symbols.
But still it cannot resolve a few symbols.
The notable file is yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ClientBase.scala. In this file, ClientArguments class is not resolved. IntelliJ suggests importing org.apache.spark.deploy.ClientBase, but in fact ClientArgument class is in the same package with ClientBase - that is, org.apache.spark.deploy.yarn.ClientArgument.
Why IntelliJ confuses this?
Thank you.
You need to change the Scala compiler from IntelliJ to “sbt incremental compiler” (see the screenshot below).
You can access this by going to “preferences” -> “scala”.
NOTE: This is supported only for certain version of IntelliJ scala plugin. See this link for details.
http://blog.jetbrains.com/scala/2014/01/30/try-faster-scala-compiler-in-intellij-idea-13-0-2/
Seems your maven cannot download jars according to your pom dependencies setting.
Two possible factors:
It could be due to your network, so you need check with proxy setting: (Ctrl+Shift+A in IntelliJ, enter "proxy", to check it connection).
It could also because your maven home has not been set in IntelliJ. to set it, you need (Ctrl+Shift+A in IntelliJ, enter "maven setting", to set maven home to point to the place where you have installed your maven.

How to convert Eclipse template file to IntelliJ template file

How can I convert Eclipse template file to IntelliJ template file. I do not want to add plugin to use the Eclipse file. I want to convert it.
Though not strictly respecting your question (no plugin), the built-in plugin Eclipse integration of IDEA 13 can import Eclipse templates quite accurately:
http://blog.jetbrains.com/idea/2014/01/intellij-idea-13-importing-code-formatter-settings-from-eclipse/
As stated in that post, the result cannot be 100% accurate as IDEA does not support all of the template options present in Eclipse (and the opposite might be true too).

Using Play Framework 2.1.0 with NetBeans

I have started using Play 2.1.0 and I would like to be able to use NetBeans to develop Play Java applications. I'm not really interested in using the IDE to run or test the applications since I can do that from the command line (not that I would mind if I could also have IDE support for that) but I would like to be able to open and edit my project in NetBeans without getting annoying errors where they don't really exist. I am currently using NetBeans 7.3 so I first tried to use the nbplay plugin, however it wouldn't recognise all my imports or managed classes produced by Play. I then tried to import the project as Eclipse project, as described in this and this question, which worked better, but while working my way through one of Play's Java tutorials I am still getting the following errors which make it really annoying to work with NetBeans:
I get an "Expected an operand but found error" error in main.scala.html where #content is used, although I have instructed the IDE to disable HTML error checking for this file.
In my model classes I get errors because the classes do not declare a no-argument constructor and have public variables for persistent attributes.
Any other errors I have not come across yet?
Has anyone managed to make Play 2.1.0 work with NetBeans without getting any of the above errors? I could probably live with the first one (although it would really annoy me) but the rest are showstoppers.
Be aware that the Java hints can be enable or disable in Tools -> Options -> Editor -> Hints -> Select java language.
NetBeans now has Native Support for Play Framework 2.3.x and above: http://nbpleasureplugin.com/documentation/installation.html No Command line needed at all.
The most important features are:
Create, run, debug and test your app directly in the IDE
Routes files support (Syntax coloring, Syntax Error highlighting, Autocompletion, Code navigation, Show implementation code (without navigate to source), Hint to Create method when it doesn’t exist, formatting, Mark occurrences)
Scala Template support (Syntax coloring, Syntax Error highlighting, Autocompletion, Code navigation, Show implementation code (without navigate to source), formatting, Mark occurrences)
application.conf support (Syntax coloring, autocompletion with documentation, formatting, mark occurrences)
Dependency Management (Search on Maven and add them to build.sbt)
2 Code Coverage too.s supported (jacoco and scoverage)
Test Single File
SBT file minimal support
Configurations (Formatting indentation, syntax coloring, port to use, activator parameters, etc.)
*Support play version from 2.3.x and above
Note: I created this plugin.
Also I see this could help you: How do I use Play Framework 2.0 in netbeans

How to setup Groovy + Eclipse + Junit4?

I am working on a small webapp and I want to use Groovy to write some unit testing for my app. Most of my coding is done on Eclipse and I really want to run all the unit testing with the graphical test runner within Eclipse (I really like the green bar :) )
Sadly, after 4 hours of try-and-error, I'm still not able to setup properly. I tried to use the Eclipse Junit4 test runner to run a Groovy file with method annotated for testing using #Test. But it keeps complaining NoClassDefFoundException
Anyone can help?
Here is content of my groovy file, named simpleTest.groovy
import org.junit.Test
import static org.junit.Assert.assertEquals
class simpleTest{
#Test
void trial(){
assertEquals 6, 3+3
}
}
Anyone can help?
You might want to give the updated plugin a try, see the the recent blog post for more details. The theme of this alpha release is providing an optimized edit/save/compile/test experience, which seems to be your exact use case.
I have this working in my environment so here is a brief summary of what I have:
In the run dialog under JUnit:
Test Tab: The test class, this must have already been compiled by the Groovy plugin.
Classpath: All of the Jar files from my project as well as the Groovy Libraries library
In Window->Preferences->Java->Build Path
Classpath Variables: GROOVY_ECLIPSE_HOME = the location where the Groovy plugin is installed
That does the trick for me.
Unfortunately, the Groovy Eclipse plugin is pretty horrible at giving actual helpful information to let you know what is going wrong with your setup. I'm going to assume you already did the verification to make sure the plugin is actually building your Groovy files (i.e. doing a sample with no dependencies, checking the properly output directory, etc...) After that, it's a lot of really small configuration verification...I've run into problems where the particular "runner" I'm using in Eclipse (i.e. in the Run menu) doesn't have the write class name defined there or for some reason my project didn't get the JUnit library dependency properly inserted into it.
Ultimately, it can be a configuration headache, but long term you'll end up saving some time and gaining some cool functionality if you can knock it out...
I had faced a similar issue and it was the missing package statement that caused me to have problems. Groovy Eclipse plugin did not complain about it but my class was present in a package. I got the noClassDefError when running the file as a JUnit Test.
Adding the package statement to top of class solved this issue.