Bringing Groovy code to the src folder in Eclipse - java

Groovy code in project structure is src/groovycode/src/packagename and rest of the java classes are in src/packagename. My other team member use IntelliJ and it seamlessly compiles groovy classes into java classes with desired package names and ignores groovycode/src folder. I am not able to do same in Eclipse and compile groovy classes at all. So I end up copying groovy class from others and copying into my WEB-INF/classes folder.Is there any way to achieve this in Eclipse?
In between I am using Eclipse Helios and have Groovy Eclipse plugin installed.

It sounds like you have not set src/groovycode/src as a source folder. You need to right click on the source folder and select Build path -> Use as source folder. Once you do that you should open up your Java build settings page for the project and set the output folder for that source folder.
I would also recommend that you upgrade to Eclipse Indigo or Juno and start using Groovy-Eclipse 2.7.0.

Related

Eclipse Build Path library jar files based in user home directory

I am not having any luck searching for a solution to this problem.
I work with a team that uses Eclipse for the java IDE, and gradle for the project build. We are developing on a linux distro.
One of the Java projects needs to use library jar files that gradle pulls down into the {homedir}/.gradle/cache directory tree.
How do I setup the project Build Path in eclipse, and the .classpath file it generates, to use a home directory variable ({HOMEDIR_VAR}/.gradle/cache/...), instead of hard-coding my home directory (/home/{myusername}/.gradle/cache/...)?
It is usually a good practice to not commit IDE specific project files to version control. Modern build tools (Maven, Gradle) integrate nicely with IDEs like Eclipse, IntelliJ IDEA and Netbeans to generate those artifacts for you.
In short, let Gradle build the Eclipse class path for you. That is either via
Buildship (Using the Gradle build system in the Eclipse IDE - Tutorial), the official Eclipse plugin to integrate with the Gradle build system. Easy to use and you can directly import Gradle projects into Eclipse.
Gradle Eclipse Plugin, a Gradle plugin that generates required Eclipse project files.
There's no need to fiddle with the class path manually anymore. However, if for somewhat reason this doesn't work out for you, there's a workaround: It is possible to relocate the Gradle home directory and with that the cache directory to a static path. This can be done for example by defining the environment variable GRADLE_USER_HOME (Gradle Goodness: Changing the Gradle User Home Directory). With that, it's possible to maintain the Eclipse class path manually and share it with your team.

Algotrader open source project not recognized as java project in eclipse

I have downloaded the open source edition of AlgoTrader from google code and imported it in Eclipse. There are two project algotrader and algotrader-strat. But the problem is that they are not recognized by eclipse as a java projects. I realized that when I tried to add a jar file and build the path. There is not ā€œJā€ on the project folder. So my question is there a way eclipse to recognize these projects as java. And if yes how can it be done?
Thanks.
https://code.google.com/p/algo-trader/wiki/AlgoTraderDocumentation#Installation
As it uses maven, maybe you can just regenerate the Elipse project files. Something like:
mvn eclipse:eclipse
I just did a quick look at the mentioned projects (I do not know them).
From what I can see, the directories you imported are the parent projects (from a Maven point of view), whose modules are in some sub-directories. For example the algotrader project contains a sub-directory called code. This one is an Eclipse project that can be imported.

How to include maven built library into your project in eclipse?

I am a novice and don't have much idea. So I have a library that is built with Maven and I want to include this library in my java project in Eclipse, how do I do this? I am using Eclipse juno on MacOSx. I want to run one of the modules in this library, so the source code is provided for this module but how do i run this?
If you are not using maven, you have to download the jar and the sources of that jar (In your case, you can download the zip file provided on the website you mention : http://code.google.com/p/cleartk/downloads/list ) and put it somewhere on your computer.
Then you have to set the build path of your project in Eclipse :
Right-click on your project -> Properties -> Java Build Path
Then you can click on the Libraries tab and Add External Jars so you can point to the jar you downloaded.
In this tab, you can attach the sources of this jar to have access to the source code in Eclipse (and eventually set breakpoint).

Update Eclipse project type through a script

I have inherited an old java project, where different team members are using different development tools; some use emacs, some netbeans, I use eclipse. Hence when this project is checked into the version control, it's just a bunch of java files and ant build files.
Every time there is a new branch or so, I checkout the project in my eclipse through subclipse plugin and generate some dependent jars, put them in classpath, then set up the source folder etc etc. This is becoming very tedious as I help out others with same configuration if they're using eclipse. Is there a way I could have some script which I can run on the project to convert and restructure it to an eclipse project?
You could have the Ant build create the .project and .classpath files for you. I've done this myself with the XMLTask suite, since those files are just XML documents. Add them to the svn:ignore property so your twitchy teammates don't get upset.
There appears to be an old ant task that does this for you, but I haven't used it myself.

Import an IntelliJ IDEA project into NetBeans?

How can I import an IntelliJ IDEA project into Netbeans?
I know I can just use IntelliJ but I prefer Netbeans...
With this particular project I can't just copy the source directory into a Netbeans project... That doesn't work?
How may I use this IntelliJ IDEA project within Netbeans?
The nbproject is a required folder by NetBeans, where it keeps its project settings. The only necessary project build files needed are the project.xml and project.properties.
In project.xml, line 5 is changed to reflect the accurate name of the user's project. Also for IntelliJ, nbintellij.iml is the required file.
So for a IntelliJ project, if you create the nbproject folder with the required files (project.xml and project.properties), you'll be able to open the folder in NetBeans
You can use the following tool I've created to convert an IntelliJ project to NetBeans, and also convert a NetBeans project to IntelliJ. Please make sure you have python installed.
https://github.com/devanshkaloti/IDEProjectConverter-Java
Short answer: I don't believe such a tool exists.
Longer answer: You probably should not be relying on a proprietary format for your project. Depending on the project, Ant+Ivy or Maven may be a better solution.

Categories

Resources