Importing a Scala project from github into Eclipse - eclipse

I've installed EGit plugin in my Eclipse Helios with latest Scala IDE plugin beta. I've imported it as a "general project" using clone and I can't find any Configure -> Add Scala nature option ... what am I doing wrong? (can't compile/run/add libraries etc)

I'm not familiar with the EGit Plug-in, but do you also have the option to import it as a Java project? The "Add Scala Nature" option is only available for Java projects.
If you can't create it as a Java project, you can also just modify the generated .project file and add the Java nature to it manually:
<nature>org.eclipse.jdt.core.javanature</nature>
(taken from http://enarion.net/programming/eclipse-change-general-to-java-project/)

One recommended approach would be first to make your GitHub project compiled/run with sbt (which ensures both IDE-independence and third-party library dependency management).
The sbt-eclifsify can easily generates .classpath and .project files for the Eclipse IDE from the sbt project.
The class ProjectFile.scala details how the .project file is build.

Related

Creating new SBT project for Scala using Eclipse

I have Eclipse (Kepler) and the Scala plugin (http://scala-ide.org/) installed.
With Eclipse, I can create a new Scala project, but its not an sbt project, so cannot add dependencies.
What is the best way to create a new skeleton sbt project, either within Eclipse, or one which can be imported into Eclipse?
Thanks
Create the sbt project yourself, then use the sbt-eclipse plugin to generate your eclipse project. This should make a .project and .classpath file in your sbt project directory. In Eclipse, use the "import existing projects" dialog.

Importing Apache Lucene-Solr into Eclipse Luna

I'm having a great deal of difficulty importing the source from git://git.apache.org/lucene-solr.git into Eclipse. I mean, I can import it as a vanilla non-java project, but that's not very helpful. It's not a Maven project, but it has this Ivy thing. I've download the IvyDE plugin, but I don't understand how to use it to import a project, and I haven't found any useful documentation from the Lucene project relevant to my problem.
Any ideas?
Edit:
To be clear, I'm not trying to add Lucene to any application. I simply want to browse the source code in Eclipse as a stand-alone project.
I did just
ant compile
ant eclipse
and then in Eclipse
File -> Import -> Existing Projects Into workspace
and that's it.
you can find the needed steps here [1]. As you said, it's not a maven project so there are some preliminary (ant) steps to do before.
[1] https://wiki.apache.org/solr/HowToContribute#Getting_the_source_code
Although Lucene is not --- at first --- a maven project, you can create a Maven project with a provided Ant target (I guess it is a target but I haven't checked the code).
In the sub-directory dev-tools/maven/README.maven there are instructions on how to make Lucene a Maven project:
ant get-maven-poms
cd maven-build
Now you can use all the normal Maven commands and import the Maven project into Eclipse (although it won't show the source).
If you wish to edit the source use:
ant compile
ant eclipse
Happy coding!
Ref.:
http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_0/dev-tools/maven/README.maven
http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_0/README.txt

Using maven generated sources in Eclipse

I have an application made up of a number of maven projects. I work on it in Eclipse. Some of the projects use Maven plugins to generate stub classes for web services etc.
When i import the projects into a new workspace I have to issue a maven generate sources command followed by attach source folders to build path on each project. The application i work on has more than 5-6 projects which require these steps.
Is there a plugin I can install in Eclipse to pick up the generated sources, or even one that generates the sources and updates the build path to save the manual steps?
I'm pretty sure the m2e plugin takes care of this automatically. m2e is included in the primary Java and Java EE packages of recent Eclipse versions, so you probably already have it. If you right-click on your project, and there is a Maven submenu, then the project is already managed by m2e. Otherwise, right-click and choose Configure > Convert to Maven project.
Well, it depends on exact maven plugin you are using.
generate sources
Before I considered that m2e connector would be needed for any non common plugin, like generator. But I came recently on some plugins (1), that do it without special m2e connector.
attach source folders to build path
For this part check build-helper-maven-plugin and answer to M2E and having maven generated source folders as eclipse source folders

How to maintain JAVA projects irrespective of IDE (Netbeans and Eclipse)

In my team, some of them are using Netbeans and some of them using Eclipse, so in our Subversion repository for each JAVA project we have Netbeans & Eclipse project files.
I do want to keep Netbeans & Eclipse project setting files inside the JAVA project, they are specific to IDEs.
Please help me to maintain only the JAVA source files inside the subversion.
Use a common build infrastructure, like maven. This encapsulates (as good as) all settings inside the maven pom.xml files (source encoding, java version etc.).
Also versioned library dependencies, subprojects are managed in maven.
NetBeans knows maven out-of-the-box, and eclipse has a good maven plugin.
In my experience manual configuration, especially in eclipse, and grown ant scripts, are cumbersome.

Is there any way to avoid Scala libraries appearing twice in an Eclipse/Scala/Maven project?

I have
Eclipse 3.5.2
Scala 2.8.0 final (inc latest Scala IDE for Eclipse)
Maven integration for Eclipse
Maven 2.2.1
.project and .classpath files generated by maven-eclipse-plugin
I'm using Scala to write Specs BDD tests for my Java code and the setup above is working very nicely so far. However, I have one puzzling problem and I would like to know whether anyone knows how to resolve it.
The Scala libraries are appearing in my project twice.
in the M2 ClassPath (as a Maven Dependency)
as an Eclipse System Library (in the same manner as the JRE System Libraries)
Consequently, when I Ctrl-Shft-T every Scala class appears twice.
Can this be avoided without breaking my Scala project in either the command line or the Workspace?
The best place for questions like this is the Scala IDE user mailing list.
The most up to date documentation on using the Scala tooling for Eclipse with Maven via m2eclipse can be found here.
To answer my own question,
it appears (as hinted at by all above) that maven-eclipse-plugin is essentially obsolete. When I
deleted my old eclipse project
removed all eclipse files (ie .settings and .project from my project directory)
removed all references to maven-eclipse-plugin from my pom
installed the m2eclipse-scala plugin
re-imported the project as a maven project
all settings were detected correctly and I no longer saw the double entry of scala classes in my classpath.