Importing Apache Lucene-Solr into Eclipse Luna - eclipse

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

Related

class missing after Importing spring framework project in eclipse

I am new to spring framework and having basic knowledge of maven. I tried to import spring project in eclipse. (File - Import - Existing Maven Projects). I see that,
1) The project is not imported as java project. i.e. if I right click on project and see the properties, I dont see options such as Java build path, Java Compiler etc.
2) I am looking for one particular class in the project, but it is not there, although I can see that class from terminal. Therefore it very much exists in the project. So why cant I see it in Eclipse ? Why is it not imported with the project ?
Please note that I use Eclipse_Juno and I can compile the project with maven on terminal and in eclipse.
There are a couple of things that could have gone wrong. Hard to say what happened.
If the project you have imported builds on the command line (mvn clean install) then chances are good it is importable into an IDE with not much trouble once the settings are ok.
Make sure you have the m2e (maven 2 eclipse) plugin available. So eclipse can detect its a maven project. If you also use spring I would give the Spring Tool Suite (STS) a try: http://spring.io/tools
If the project is not recognized as java - or the essential facets are not detected - I would try to figure out why. Maybe something in the preferences is not properly set up? (maven home, executables, sdk, ...)

Regarding Maven

I am new to Maven and if you feel i am asking really basic question then please forgive me.
I am facing couple of problems with Maven mentioned below.
I am using Eclipse Luna 4.4.1 (Which comes with the Maven Plugin).Now i installed two plugins..out of which one is for subclipse(with SVNKit) and m2e-Subclipse which is used for integrating the maven with SVN.I downloaded the project in eclipse using svn plugin as "checkout as Maven project" and i could see the project being downloaded and now to remove all the errors related with the POM.XML i downloaded the Maven and given the local path of the Maven in the preferences > Maven > installations and changed the Global Settings and user settings files which are project specific.
1). Now even after doing all this circus i still can not see the Maven build options in my Eclipse.
2). I am not even able to clean the project from command prompt.
when i go to my project directory and type "mvn -version" which shows me the correct version of maven.
But when i try to clean it using mvn clean. it does not work.
Please help.
Regards.

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 can I execute Maven goals from Eclipse without M2Eclipse?

I am using the eclipse plugin for maven to generate eclipse projects from maven pom.xml files.
mvn -Dwtpversion=1.5 eclipse:eclipse
This works fine and, after some experimenting with several of the 400 different archetypes available, I settled on using the webapp-javaee6 archetype, which was the only one which generated a set of dependencies that were both all available and which created a project that was useable by the WTP plugin.
The problem now is that I would like to be able to invoke mvn goals from eclipse. The accepted way to do this I understand is to use the m2eclipse plugin, which I have installed.
However, after playing around a bit and getting nowhere I discovered this comment in my .project file:
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
Further searching (see this lengthy diatribe from October) suggests I'm not (just) being stupid in not being able to get this to work.
The how-to linked in the top answer to this question seems hopelessly out of date.
So, the real question - what is currently the correct way to use maven to generate a WTP-friendly project that can be converted to eclipse and then use eclipse to call the project's goals?
Have you tried File -> Import -> Check out existing Maven Projects from SCM? My understanding is that m2eclipse will then create the eclipse project for you. If the packaging defined in the pom is war, the project should be deployable with WTP. (The latter used to require an the maven-wtp-integration plugin as well, don't know whether that's still the case).
Not sure about WTP or maven archetypes, but have you come across SpringSource Tool Suite (Spring packaged eclipse) and created a Spring Roo project? You can use this to create a data driven maven built web-app in a few mins. You can even remove the spring roo bits if you don't want them, it will give you a good starting point for a web-app with very little pain.

Is there a way to let maven configure code templates in eclipse?

eclipse has the possibility to configure code templates per project. These are stored in /.settings/org.eclipse.jdt.ui.prefs.
when you have a maven project you usually omit all eclipse project stuff and only keep the pom.xml. Then you check it out in eclipse and the m2eclipse plugin generates the project files. Maven even writes the above /.settings/org.eclipse.jdt.ui.prefs.
The problem with this approach is that every developer needs to specify the same templates for the project, since the pom.xml does not know about templates, and so maven does not write them to the prefs file.
I googled for eclipse maven code template and found only that the maven-eclipse plugin is capable of defining a code style in eclipse, but i did not find anything about templates.
Does anybody know of a maven plugin which can solve this?
Any workarounds or other solutions for this?
I use workspacemechanic to share my eclipse settings between different workspaces. Sharing code templates (Window->Preferences->Java->Editor->Templates) seems to work too.
Its an eclipse plugin you have to install, no maven plugin.