how to build Hadoop eclipse plugin - eclipse

I would like to be able to build Hadoop eclipse plugins from
http://svn.apache.org/repos/asf/hadoop/common/tags/
I have managed to get the source into my Eclipse workstation using subclipse, and now I want to build the jar. Do I build it as executable jar? There is no launch configuration associated to the source. Is there a tutorial on how to do this?

The usual approach is :
Checkout the code from Apache's SVN (Done in your case).
Modify build.properties in /src/contrib/eclipse-plugin and add : eclipse.home=/path/to/your/eclipse/folder
Download apache forrest 0.8 and sun jdk (Preferably java 6).
Run ant command as "ant clean package -Djava6.home=/usr/lib/jvm/java-6-sun (Change the path according your machine and make sure you are connected to the network)
At this point eclipse plugin should be there in /build/contrib/eclipse-plugin but the jar is not yet ready to work as
it misses some required jars.
Add the following jars from your HADOOP_HOME/lib folder to the plugin/lib folder commons-configuration-1.6.jar
commons-httpclient-3.0.1.jar commons-lang-2.4.jar
jackson-core-asl-1.0.1.jar jackson-mapper-asl-1.0.1.jar
Modify MANIFEST.MF in /META-INF of the jar to include the path of these added jars.
Copy this jar to plugins folder of eclipse
Run "eclipse -clean"
There are some posts over the net for the same. See if they work for you :
Link 1
Link 2

Related

Eclipse PDE Build plugins output some folders are jar-ed

I am running eclipse PDE Build from ant file. I succesfuly get the product but in the ant generated product I get some folders in plugins directory jar-ed unlike the folders I get during the export product from eclipse.
What can be the reason to have the plugins as jar but not folder ? Is there a parameter to set ?
ilke
Yes, in the MANIFEST.MF file of each plugin, you can specify this property:
Eclipse-BundleShape: dir
By default the plugin is jar-ed. With this option, it is expanded as a directory during installation of the plugin.
Note: This option is available since Eclipse 3.5 only.

Making Eclipse Maven repository inside the project

I'm a real beginner to Maven and Spring framework in eclipse so excuse me if this sounds trivial..
I have created a MVC web project in eclipse using the STS plugin on my windows computer, but my problem is that the location of the jar and configuration files that maven is set to by default is: C:\Users\MyName.m2\repository
This is a problem for me because eventually I'm going to make a WAR file out of my project and deploy it on a Linux machine, which does not have Maven installed on it.
My question is, is it possible to take all the jar files in my Maven repository, and make a local repository on the project itself rather than on an absolute path on the machine (sort of like a lib folder within the WEB-INF in the project that will hold all the maven jars and that maven will direct itself to it), and thus making the transition to the Linux machine smooth
I understand there is this classpath variable named M2_REPO, but doesn't seem to be editable or accept relative path rather than absolute.
Thanks in advance
Since you are using maven and you are adding your dependencies on your pom.xml, then all the dependencies with a scope of "compile" will be added to your final war file created by the maven war plugin under the WEB-INF/lib folder, this means that you should not worried about having maven in your linux server, since the war file that you are going to deploy will contain all the necessary dependencies. If you want to confirm this, just create a package of your project using "mvn clean package" and check the "target" folder generated by maven, you will see a "war" file, and you can unzip your file to check what contains.

Maven dependency Hibernate library cannot be read

I'm getting the following error in eclipse.
Archive for required library: '~/.m2/repository/org/hibernate/hibernate-core/4.2.1.Final/hibernate-core-4.2.1.Final.jar' in project
I've done Maven->Update Project and still it can't recognize the library.
I've verified that the jar file exists in the location mentioned.
This post has the same error as I do but I double checked my pom and there are no duplicates.
Check access settings for file '~/.m2/repository/org/hibernate/hibernate-core/4.2.1.Final/hibernate-core-4.2.1.Final.jar' if you are using *nix system,
Also make sure you can open hibernate-core-4.2.1.Final.jar archive using third party tools e.g. 7zip or winrar. from my experience many times maven in eclipse does not properly download dependency and downloaded jar is corrupted. If that is the case you can manually download this jar and replace it in .m2 repository.
Try to run maven task eclipse:eclipse from command prompt
open command prompt, Change Directory to project root directory and type
mvn eclipse:eclipse
And go back to eclipse and refresh project and see will it works :)

add jar to eclipse plugin (hadoop)

I need to run an Eclipse (Indigo version) plugin, but from the error log I find out that I am missing 2 jars.
How can I add the missing jar to Eclipse so that I can run the plugin?
Is there a way to add the jar to the existing plugin?
If this is of any help, I try to run Hadoop Map/Reduce perspective and I found out that I should add commons-configuration and commons-lang.
The simplest way is to just copy the Jar file(s) into your plugin project, and then go to the plugin manifest (open the MANIFEST.MF file) and add them to the classpath on the Runtime Tab. Also on the Build tab, make sure they are checked so that they are included in the output of the plugin.
There are other ways, like making a special plugin to house only the required Jar files, or get the bundle (plugin) that might already contain that Jar file from someplace like Orbit.

How can I add the external jar to the eclipse rcp application?

I tried to add the apache vfs jar file as the runtime dependency. Even though it throws the below error:
java.lang.ClassNotFoundException: org.apache.commons.vfs.VFS
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at file_explorer.View.setInput(View.java:295)
at file_explorer.View.initialize(View.java:130)
How can i resolve this, thanks in advance.
If you are looking for adding the required jars to your project classpath.Add the required files to lib directory in the project structure.Then from project click the 'run time' tab of plugin.xml and add the required jars from the lib directory to the project classpath.
The best way to include external Jar in Eclipse RCP application is to package it as a plugin and then use classic plugin dependency.
Just create a new plugin containing only your Jar. Then in the build tab of the manifest editor, add your jar to the classpath (at the bottom right) and export all its packages in this same runtime tab. Also be sure to check that you jar is checked in the Build tab.
Nevertheless you should be able to use the jar in a Given plugin source code if you only add it to the classpath as I mentioned previously.
Because some other of your plugins may be interested in using the vfs jar and for separtion of concerns matter I think you should wrap it in its own plugin
The easiest way is to find bundle in an existing OSGI bundle repository.
http://bundles.osgi.org/Main/Repository
http://www.springsource.com/repository/app/
http://www.eclipse.org/orbit/
http://www.knopflerfish.org/repo/index.html
springsource repo contains apache VFS bundle
Then you need to add the bundle to the target platform (or just copy it to the dropins folder)
In order to properly install bundle into a newer version of eclipse you should use an existing p2 repository and install bundle from p2 repository into your runtime platform. There are two ways: you could use existing one (like orbit p2 repo), or you could create your own using p2 publisher as described at https://docs.sonatype.org/display/TYCHO/How+to+make+existing+OSGi+bundles+consumable+by+Tycho
Eclipse RCP is an OSGi environment which extends the Java dependency model, so you can't simply take a jar file and hope it works. To use an external jar, you have to build it to a plugin first, which p2-maven-plugin can help, you can follow the readme document.
With the plugin ready, you should install the plugin and add it to MANIFEST.MF. Then restart Eclipse to make the plugin work.
A more easily way, you needn't install the plugin, just follow(but build the jar):
go to plugin.xml -> Runtime tab;
click Add at the classpath section, then add the plugin to classpath;
make sure there is . path in the text area, otherwise New it.