Eclipse not seeing test folder with Gradle plugin - eclipse

I am using Gradle for my project, and the Eclipse plugin to generate Eclipse settings.
It successfully sees the main folder as a source folder, but not the test folder. This makes it a pain to automatically generate a unit test class through Eclipse.
How to fix this ?

Add this line to your Gradle build file:
eclipse.classpath.plusConfigurations += [configurations.testCompile]

Related

Groovy Gradle"Project is missing required library" error in eclipse

I've created a Groovy project and build with Gradle from command line, all fine. But after load it into eclipse, I got lots of following errors inside the IDE. The project build path is pointing to these non-exist jars.
Project 'nexus' is missing required library: 'C:\Users\jironghu.gradle\caches\modules-2\files-2.1\commons-beanutils\commons-beanutils\1.8.0\c651d5103c649c12b20d53731643e5fffceb536\commons-beanutils-1.8.0.jar'
My bad, the eclipse project was generated in another company where my id was different. Just need to delete the eclipse .project and .classpath re-create them by "gradlew eclipse".

Eclipse build path missing

Hi I am working on a project and I have imported it via gitHub. I am importing it as a general project, it won't work otherwise. The problem I have is that there is no buildpath for the project. From java I can't run any of the files but I can run it fine in source tree with gradle.
I have read up on it and it says the way to fix it is:
Right-click > properties > build path
That or similar options but in my eclipse there is no BUILD PATH option.
I have tried looking at some fixes here and here. From the second link I have found that the following files are missing:
.classpath
.settings/*
If the project has a gradle wrapper in the root of the project then use it to invoke the tasks cleanEclipse eclipse to produce the eclipse artifacts.
Assuming you're on unix type system:
./gradlew cleanEclipse eclipse
If you're on windows, use gradlew.bat instead.
If the GitHub project didn't have a gradle wrapper, then you can use a system version of gradle instead.
This all assumes the project has following in it. If not add it to the main build script:
apply plugin: 'eclipse'

TestNG test cases not auto compiling in Eclipse

I have a Maven project imported as General --> existing workspace into my eclipse.
When i write a new test file or edit an existing test file, the file does not seem to auto build. My build path is correct and the test out put folder is in \target\test-classes
any help here?

NetBeans -- Is it possible to bypass the IDE-generated Ant build for an existing project?

I have a Java project with sub-projects that is currently built using NetBeans's IDE-generated Ant scripts. I am converting the entire project to a Maven build.
My Maven build works fine from the command line and loads perfectly in Eclipse. However, the only way I can get the project to load as a Maven project in NetBeans is to delete the Ant scripts, i.e. build.xml and the directory nbproject for each sub-project. It seems that as long as I have the old IDE-generated build files, NetBeans recognizes the project as a NetBeans Java project only, not as a Maven Java project, even though there is also a pom.xml file present.
Short of deleting the IDE-generated build files, is there any way to tell NetBeans to load the project as a Maven project?
I have been told that we want to keep the Ant build for a while during the transition to Maven.
Using NetBeans 6.9.1, Maven 2.2.
Any help would be appreciated.
Thanks
Well, the nb ant project metadata has precedence over occurence of pom.xml file (that's how maven projects are recognized and loaded). The whole precedence order hardwired in the IDE, you could only influence it be uninstalling the j2se ant project type for example.
So, yes. You need to get rid of the ant project metadata before you can open the project as maven project. Depending on how and when you delete the metadata, you might need to restart the IDE as well to get the new stuff loaded.
Have you seen http://wiki.netbeans.org/MavenBestPractices? It indicates that you must install the NetBeans maven plugin first. Perhaps that's why your Maven projects aren't recognized.
I must note that I'm not a NetBeans user anymore!
Here is what I ended up doing:
I wrote an Ant script (ironic, huh?) that, for every subproject of my project, renames the file nbproject/project.xml if it exists to nbproject/nb_project_disabled.xml. If nbproject/nb_project_disabled.xml exists instead, the script renames it back to nbproject/project.xml. In this way, the script toggles the opening of the project as a NetBeans Ant build or as a Maven build.
It would be nice if NetBeans, you know, had a setting to open both kinds of projects. Currently (6.9.1), there is just the "Open Project" command. In Eclipse, there is the command "Import Existing Maven Projects" vs. "Import Existing Project Into Workspace" (i.e. native Eclipse format).

How to refresh a eclipse project built from ant build file?

I created a new project in eclipse using an existing ant build file (using the eclipse feature).
Is there a way to refresh the project, if the ant build file is modified?
For example, there were new build path dependencies added to the build.xml but in eclipse those files were not added to the project build path.
I believe once the project has been created you have to keep them up to sync manually. Either that, or delete the project in eclipse and create a New project from the newly updated ant file.