I'm using Eclipse Neon2 (4.6.2). I'm trying to use Spock Framework (http://spockframework.org/). Here's what I did so far:
Added the Groovy plugin to Eclipse. Since in the Eclipse Market there's no Groovy plug-in for this specific version of Eclipse (Neon2 V4.6.2), i followed the instructions mentioned here and specifically in the 'How To Install' section: https://github.com/groovy/groovy-eclipse/wiki
I right clicked on my Eclipse Project and converted it to a Groovy project.
I installed Spock Plugin 2.13 by Jspresso from the Eclipse Marketplace.
I right-clicked on my Eclipse project and added the 'Spock Nature' to it.
At this stage I'm able to create Groovy classes but the IDE still cannot identify Spock syntax. For example when extending Spock's Specification class, we get a class not found or package not found error.
I realize how this can be much easier using Maven or Gradle, but that's a long story now and I'm just trying to find out what i'm doing wrong so far.
Thanks.
Did you add Spock as a dependency of your project? It needs to be on the classpath when compiling your tests.
Related
I am working on a main project that depends on dbunit. dbunit is defined as a dependency in the Maven pom. It works find, but I found a bug in dbunit and would like to fix it.
Now, I download the source code of dbunit. How can I instructs IntelliJ IDEA and Maven to use that code instead of the maven dependency? Note that my project use subversion, dbunit uses git. My project si Java 1.8 based, dbunit is Java 1.5.
Ideally, I want to be able to simply change the code in dbunit and the hit the compile button in my project, and everything gets compiled and running. I could also debug within my code and then fall into's dbunit's code.
I have wasted an hour trying to import dbunit as a module, but to no vail. dbunit has a parent in the pom.xml that does not correspond to my project and it must remain as such.
So what is the best possible setup to work on both project, one depending on the other?
You need to import both projects (as modules) into a single IntelliJ project.
If you run your code by IntelliJ (but not by using Maven goals), it will use the dbunit module, instead of using the artifact in your repository.
Modules in your IntelliJ projects can be completely unrelated, it does not matter which parents they have.
I'm using Eclipse and working on a J2EE project. We are trying to write Groovy/Spock tests for unit testing. The project is a Maven project and added Groovy nature to it. The problem is If I edit any of the Groovy test classes, It's doesn't get compiled. So running a test as Junit is not picking up the latest changes. I have to run a Maven build in order to pickup the recent changes test class.
My setup,
Groovy compiler 2.4
Installed Groovy-Eclipse plugin
Added Groovy nature to the project
Checked another question, it didn't help much
Another Question
Un checked, the following fixed the issue.
Preferences > Groovy > compiler > Enable script Folder support
I have an open source Eclipse Google App Engine project (it's called LastCalc and it's open source, you can find it here, created using the GAE Eclipse plugin.
The problem is that several months ago I switched IDEs to IntelliJ IDEA. Since most of my projects were Maven-based this wasn't an issue, but LastCalc was stubbornly tied to Eclipse.
I'm hoping that someone can suggest an easy way to migrate this project to Maven such that it will work nicely in both IDEA and Eclipse.
We released the app engine maven plugin and a gustbook sample with that plugin. I don't think the manual migration is very difficult. You can create a directory structure similar to our guestbook sample and copy your source and resource files. Dependency might be a bit cumbersome, so maybe you can try the 'Convert to Maven Project' functionality of the newer version of m2eclipse.
I'm looking for a plugin that would run in a console continuously to scan a Maven project's test sources directory, and when it detects a change kicks off a test cycle. Something analogous to mvn scala:cc or the Scala Build Tool, but for Java. Can anyone point me towards one?
I have personally used sbt even for a java only project just for continuous test feature.
I added a sbt build file to a maven based project and use sbt when developing, but use maven when building the final package, starting embedded jetty etc and this has worked out quite well.
I've just discovered that the scala-maven-plugin supports both continuous compilation & testing, as well as cross-compilation (Java + Scala). So it's possible to use it over a pure Java build and get all the continuous build goodness.
Recently, I have had a need for a solution to this. Having been learning scala and finding about the goodness of sbt ~test, I want to apply it to Java projects that do not have continuous test.
Using the scala-maven-plugin that you mentioned, I have created a github seed that will run Java Junit tests everytime I save a Java source or a Java test.
Check it out:
https://github.com/ailveen/maven-scala-java-continuous-test
The project is very simple right now (contains only Java files because that is my current need) but in the future I hope to add scala test (or specs2 or scalacheck) so it works with mixed java and scala files.
Hope you find it useful.
It is not exactly for Maven, but JUnit Max does continuous testing and if you're on Eclipse it might be the tool you would like to check out
My web project includes Groovy class files.
How should I compile it for my project using Eclipse?
Rest of my team is using IntelliIDEA to use it but I want to set it up in Eclipse.
To start with I have installed a Groovy Plug-In for my Eclipse and installed Groovy on my Windows.
You should be able to right click on the project -> Configure -> Convert to Groovy project.
If your project is a maven project, then you should also install m2eclipse as well as the optional m2eclipse configurator for groovy-eclipse. This will automatically configure your project for Eclipse and groovy.
Hope this links helps you. It has step by step on how to import your existing Groovy Project into eclipse so you can work on it.
http://docs.codehaus.org/display/GROOVY/Create+Your+First+Groovy+Project
If the project is created using grails create project, I believe all of the .project and .setting files are there for eclipse.
If you have the groovy eclipse plugin installed you should be able to mix your groovy classes into the same packages as your java code. Are you using maven or ant to build your actual war file? If not you will have to make sure that you compile the groovy classes along with the java code. while in eclipse you will be fine. Both ant and maven have facilities for compiling the groovy and java code together for your actual war that you deploy.