I have some groovy files in Eclipse and my project has the Groovy nature. I don't use the GroovyBuilder (I don't think you need to now. there were problems in the past when java files referenced groovy and vice versa). Sometimes when I run my project I get a "Stubbed Method" error and I need to do a project clean for the groovy files to rebuild. Any ideas why I need to do this and what causes the files to need rebuilding if I'm not changing them?
thanks,
Jeff
It sounds like you are using an old version of the plugin. Please upgrade to V2 of groovy-eclipse (still in alpha, but quite stable).
The update site is available here:
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.5/
Also, be sure to convert all your old groovy projects to the new format (see the groovy preferences page).
Related
I'm trying to install Java Deep Library. There seem to be about a million different ways to accomplish this. I am using the Eclipse IDE. Thus far I have tried to import the project using Gradle, however I am unfamiliar with Gradle and I do not know which folder to specify from the list of folders.
I have also tried adding Maven dependencies, but I do not know what any of this actually means and I don't know how to actually use them.
I've only just started using Java. I don't really understand how to get a Java project from github and start using it, which is why I'm having so much trouble.
I have an eclipse Java project and want to get information like project source dir, classpaths, etc. My current implementation parses the .project file. But as I didn't find any official documentation describing the structure of the .project file, I have some concerns for the robustness of this approach.
A more convenient and robust way would be to use JDT (headlessly) to load the project and get the relevant information from the IJavaProject object.
Although the developer guide of JDT says
JDT Core packages give you access to the Java model objects and headless Java IDE infrastructure.
all the examples I can find opening an existing Java project get the IJavaProject object from projects within a workspace or use an IProject object. But I couldn't find the way to add a project to the workspace or to construct a IProject/IJavaProject from a path to .project file.
Could anyone please help?
Yes, and can all be done through clear and stable API. org.eclipse.jdt.core is a plug-in, just like org.eclipse.core.resources (which is where you would get an IWorkspace instance), and they both expect to be running within an Eclipse runtime, which can be headless if that's how you write your Eclipse Application. JDT uses the .classpath file to record where sources, libraries, and build output are, and what abstracted references to libraries to use, while the .project file is what records what kind of project it is in general--Java, PHP, Web, some combination of those or others--and a little more information about what builders to execute.
So make yourself a headless Eclipse Application, or package your end-goal functionality inside of one.
https://wiki.eclipse.org/FAQ_What_is_an_Eclipse_application%3F
https://wiki.eclipse.org/FAQ_What_are_extensions_and_extension_points%3F
http://help.eclipse.org/mars/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_core_runtime_applications.html?cp=2_1_1_27
http://help.eclipse.org/mars/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/resources/ResourcesPlugin.html#getWorkspace--
http://help.eclipse.org/mars/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html#getJavaCore--
http://help.eclipse.org/mars/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/IJavaProject.html#getResolvedClasspath-boolean-
See http://www.ant4eclipse.org/ for a project which allows you to work inside Eclipse projects.
I used it for a bit some years back, and found that this is too brittle for long term usage and build scripts. I would recommend against relying on internal Eclipse things. They break! Typically when mixing releases.
Instead I would suggest you move to Maven. This is a bit more work, but allows you to use the whole maven infrastructure and API's to do things. What you want to achieve here, may be possible already using a Maven plugin.
I'd like to make Gradle use Eclipse project dependencies. Unlike this question, I don't want to do any export as I don't want to hunt down problems due to forgetting to re-export after a change. And unlike this question, I don't want to integrate Gradle into Eclipse at all, as I'm satisfied with how my Eclipse works (it's much faster than a Gradle build) and I'm also afraid that my Eclipse 3.7.2 may be too old for such games.
Ideally, I'd like something like
dependencies {
compile allFilesFromEclipse()
}
Actually, getting the JARs would suffice.
What I've tried: Just some light googling. I could imagine parsing the .classpath file myself, but it's not done in 5 minutes, so I'm asking if there's an existing solution.
I am afraid you won't find much help. It is not obvious what problem you want to solve here. Most developers prefer to base their build on a build tools rather than expect that they will replicated an IDE setup everywhere.
As for Eclipse 3.7.2: I am not sure why you want to stick with that but gradle eclipse generates files that work with this version.
I'm fairly new with ScalaTest, and now that I've got it running with Maven, of course I'd like to have it working well in Eclipse as well. My project is a Java project, but I want to improve my Scala skills by writing the tests with ScalaTest.
I understood it so that I should right-click on my project, say "Configure" and "Add Scala Nature". Doing that, however, makes Eclipse try to compile all my Java files with scalac, giving me a lot of "Scala Problem" entries in the problem list. Of course, not having the Scala nature gives me a lot of "Java Problem" entries in my project for all of my Scala files. How can I add the Scala nature only to src/test/scala?
Cheers
Nik
Maybe the simplest solution (in your context, i.e. classic Java project, without M2Eclipse and a Maven project) would be to have two separate projects:
one with only the Java Nature
one with the scala nature for tst.
Since you can link a directory in your second project, you don't have to move the sources of the tests(src/test/scala) from your existing file set.
You only have to exclude src/test/scala from any compilation in the first (Java only) project.
I have looked for an answer for this nearly every where that I can think of, but there doesn't seem to be any way to actually SEE what Eclipse "runs" to compile the projects (as it does need the JDK installed and visible to actually build). I ask because I imported a few jars into my project, and even though I've looked through all the javac documentation, I can't seem to figure out how to mimic it quite like Eclipse does. I really, really need to be able to compile on the command line in this case - Eclipse or any other IDE just isn't what is needed.
I started to look through the Eclipse source, and although this sounds lazy, I just became overwhelmed and figured I would ask here first, hoping someone else had the same question at one point.
Eclipse JDT does not require the JDK and does not use javac - it uses it's own compiler.
You can see the classpath by reading your project .classpath file. The various builders that are used to perform build operations (Java, or whatever the project builds) are listed in the .project file. (These are also listed in the project settings.)
It is possible to invoke Eclipse to build your project in headless mode, or write Ant scripts that can be executed both with the JDK and within Eclipse, or install Maven support for internal and external building. It is also possible to configure the project builders to rely only on external tools.
Look at these two articles.
http://www.eclipse.org/articles/Article-Builders/builders.html
http://www.eclipsepluginsite.com/builders-natures-markers.html
Look at your .classpath file and start building an ANT build.xml. You need to do this to be able to have consistent builds on a build machine anyways. It is unlikely that a build server would have eclipse installed on it anyways.
Maven is also another tool that is used for builds. In our shop we use Ant.
Have a look at ant4eclipse - this project allows for generating the appropriate ant data structures for invoking <javac> from the .classpath files and a projectSet.psf file.
By using this we can use Eclipse "natively" and bend ant to conform to Eclipse. The usual approach is the other way around.