FAQ
Hi,

I've been trying to set up Hadoop as an Eclipse project, but am having
some difficulties. I've tried importing a project and using the
Eclipse subversion plugin, I've tried creating a project from an
existing source and pointing it at my Hadoop installation folder. I've
also tried creating an empty project and importing in an existing
filesystem - my hadoop installation.

ALl these methods create a project, but with the following problem.
While Eclipse correctly recognises most packages and creates these as
packages in the package explorer, under a src/java package folder, the
org.apache.hadoop.fs and org.apache.hadoop.mapred packages behave
differently. They are put in src/java/org/apache/hadoop/fs and
src/java/org/apache/hadoop/mapred folders, with all their classes then
in the default package under this folder.

As a result there are errors in the project due to eclipse not being
able to resolve names, and I can't compile. I was wondering if anyone
else had come across this problem and been able to sort it out. Or
perhaps this question is better asked in an eclipse forum? BTW, It
won't let me rename in the usual fashion - refactor->rename.

Thanks for any help,
Ollie

Search Discussions

  • David J. Biesack at Jul 18, 2007 at 2:01 pm
    The following .classpath file works for me (I started with the source distribution, not svn)

    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="src" path="src/contrib/abacus/src/examples"/>
    <classpathentry kind="src" path="src/contrib/abacus/src/java"/>
    <classpathentry kind="src" path="src/contrib/streaming/src/java"/>
    <classpathentry kind="src" path="src/contrib/streaming/src/test"/>
    <classpathentry kind="src" path="src/examples"/>
    <classpathentry kind="src" path="src/java"/>
    <classpathentry excluding="testjar/" kind="src" path="src/test"/>
    <classpathentry kind="src" path="src/test/testjar"/>
    <classpathentry kind="src" path="gen/test"/>
    <classpathentry kind="lib" path="lib/commons-cli-2.0-SNAPSHOT.jar"/>
    <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
    <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-api-1.0.4.jar"/>
    <classpathentry kind="lib" path="lib/jets3t-0.5.0.jar"/>
    <classpathentry kind="lib" path="lib/jetty-5.1.4.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/ant.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/commons-el.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/jasper-compiler.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/jasper-runtime.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/jsp-api.jar"/>
    <classpathentry kind="lib" path="lib/junit-3.8.1.jar"/>
    <classpathentry kind="lib" path="lib/log4j-1.2.13.jar"/>
    <classpathentry kind="lib" path="lib/servlet-api.jar"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="build"/>
    </classpath>
    Date: Wed, 18 Jul 2007 14:56:12 +0100
    From: ojh06@doc.ic.ac.uk

    Hi,

    I've been trying to set up Hadoop as an Eclipse project, but am having
    some difficulties. I've tried importing a project and using the
    Eclipse subversion plugin, I've tried creating a project from an
    existing source and pointing it at my Hadoop installation folder. I've
    also tried creating an empty project and importing in an existing
    filesystem - my hadoop installation.

    ALl these methods create a project, but with the following problem.
    While Eclipse correctly recognises most packages and creates these as
    packages in the package explorer, under a src/java package folder, the
    org.apache.hadoop.fs and org.apache.hadoop.mapred packages behave
    differently. They are put in src/java/org/apache/hadoop/fs and
    src/java/org/apache/hadoop/mapred folders, with all their classes then
    in the default package under this folder.

    As a result there are errors in the project due to eclipse not being
    able to resolve names, and I can't compile. I was wondering if anyone
    else had come across this problem and been able to sort it out. Or
    perhaps this question is better asked in an eclipse forum? BTW, It
    won't let me rename in the usual fashion - refactor->rename.

    Thanks for any help,
    Ollie

    --
    David J. Biesack SAS Institute Inc.
    (919) 531-7771 SAS Campus Drive
    http://www.sas.com Cary, NC 27513
  • Ojh06 at Jul 18, 2007 at 2:34 pm
    Hi David,

    Thanks very much for the quick reply. I'm happy to say that worked
    perfectly - all the packages are displaying fine now. However, when I
    tried to build it I was getting a build error. I searched the archives
    and found this:
    BUILD FAILED
    /cse/grads/eestolan/hadoop-0.12.3/build.xml:114: Specify at least
    one source--a file or resource collection.
    I'm guessing the non-existence of the *.template files (e.g.
    hadoop-site.xml.template) in the *conf* directory of the releases is
    causing this... I'm not sure you can just d/w the release and compile it...

    I'd suggest you checkout the 0.12 branch from here:
    http://svn.apache.org/repos/asf/lucene/hadoop/branches/branch-0.12/

    So I tried checking out from SVN and it has created a project which is
    displayed in the package explorer as a set of folders, no eclipse
    package icons. It builds fine, but is a bit of a pain as I have to
    open several folders to get to each pacage instead of one. I've tried
    changing the .classpath to your suggestion but that has no effect now.
    Anyone got any ideas, or should I just make do with this?

    Cheers,
    Ollie
    Quoting "David J. Biesack" <David.Biesack@sas.com>:
    The following .classpath file works for me (I started with the
    source distribution, not svn)

    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="src" path="src/contrib/abacus/src/examples"/>
    <classpathentry kind="src" path="src/contrib/abacus/src/java"/>
    <classpathentry kind="src" path="src/contrib/streaming/src/java"/>
    <classpathentry kind="src" path="src/contrib/streaming/src/test"/>
    <classpathentry kind="src" path="src/examples"/>
    <classpathentry kind="src" path="src/java"/>
    <classpathentry excluding="testjar/" kind="src" path="src/test"/>
    <classpathentry kind="src" path="src/test/testjar"/>
    <classpathentry kind="src" path="gen/test"/>
    <classpathentry kind="lib" path="lib/commons-cli-2.0-SNAPSHOT.jar"/>
    <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
    <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-api-1.0.4.jar"/>
    <classpathentry kind="lib" path="lib/jets3t-0.5.0.jar"/>
    <classpathentry kind="lib" path="lib/jetty-5.1.4.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/ant.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/commons-el.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/jasper-compiler.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/jasper-runtime.jar"/>
    <classpathentry kind="lib" path="lib/jetty-ext/jsp-api.jar"/>
    <classpathentry kind="lib" path="lib/junit-3.8.1.jar"/>
    <classpathentry kind="lib" path="lib/log4j-1.2.13.jar"/>
    <classpathentry kind="lib" path="lib/servlet-api.jar"/>
    <classpathentry kind="con"
    path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="build"/>
    </classpath>
    Date: Wed, 18 Jul 2007 14:56:12 +0100
    From: ojh06@doc.ic.ac.uk

    Hi,

    I've been trying to set up Hadoop as an Eclipse project, but am having
    some difficulties. I've tried importing a project and using the
    Eclipse subversion plugin, I've tried creating a project from an
    existing source and pointing it at my Hadoop installation folder. I've
    also tried creating an empty project and importing in an existing
    filesystem - my hadoop installation.

    ALl these methods create a project, but with the following problem.
    While Eclipse correctly recognises most packages and creates these as
    packages in the package explorer, under a src/java package folder, the
    org.apache.hadoop.fs and org.apache.hadoop.mapred packages behave
    differently. They are put in src/java/org/apache/hadoop/fs and
    src/java/org/apache/hadoop/mapred folders, with all their classes then
    in the default package under this folder.

    As a result there are errors in the project due to eclipse not being
    able to resolve names, and I can't compile. I was wondering if anyone
    else had come across this problem and been able to sort it out. Or
    perhaps this question is better asked in an eclipse forum? BTW, It
    won't let me rename in the usual fashion - refactor->rename.

    Thanks for any help,
    Ollie

    --
    David J. Biesack SAS Institute Inc.
    (919) 531-7771 SAS Campus Drive
    http://www.sas.com Cary, NC 27513
  • David J. Biesack at Jul 18, 2007 at 2:46 pm
    note: I had changed build.xml

    <property name="test.generated.dir" value="${test.build.dir}/src"/>

    to

    <property name="test.generated.dir" value="${basedir}/gen/test"/>

    in order to be able to run the Ant script; I then added the gen/test directory to the Eclipse build path. But I don't recall seeing any problems such as the error you reported with template files when I ran Ant. I was using Ant 1.6.5.
    Date: Wed, 18 Jul 2007 15:34:10 +0100
    From: ojh06@doc.ic.ac.uk

    Hi David,

    Thanks very much for the quick reply. I'm happy to say that worked
    perfectly - all the packages are displaying fine now. However, when I
    tried to build it I was getting a build error. I searched the archives
    and found this:
    BUILD FAILED
    /cse/grads/eestolan/hadoop-0.12.3/build.xml:114: Specify at least
    one source--a file or resource collection.
    I'm guessing the non-existence of the *.template files (e.g.
    hadoop-site.xml.template) in the *conf* directory of the releases is
    causing this... I'm not sure you can just d/w the release and compile it...

    I'd suggest you checkout the 0.12 branch from here:
    http://svn.apache.org/repos/asf/lucene/hadoop/branches/branch-0.12/

    So I tried checking out from SVN and it has created a project which is
    displayed in the package explorer as a set of folders, no eclipse
    package icons. It builds fine, but is a bit of a pain as I have to
    open several folders to get to each pacage instead of one. I've tried
    changing the .classpath to your suggestion but that has no effect now.
    Anyone got any ideas, or should I just make do with this?

    Cheers,
    Ollie

    --
    David J. Biesack SAS Institute Inc.
    (919) 531-7771 SAS Campus Drive
    http://www.sas.com Cary, NC 27513

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedJul 18, '07 at 1:56p
activeJul 18, '07 at 2:46p
posts4
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

David J. Biesack: 2 posts Ojh06: 2 posts

People

Translate

site design / logo © 2022 Grokbase