It is fine to not add .classpath/.project files if your project is simple and has few external dependencies. In practice you often have a number of relationships to maintain, so the overhead of making your .classpath portable is much less than the cumulative overhead of redefining it each time you bring the project into a workspace. The more involved your configuration, the more subtle errors you'll be fighting against attempting to reconstitute the project configuration.
You should be able to set up your classpath so it is portable by using Variables and Libraries, this avoids the need to hard-code paths. Your team can agree on a standard set of variables (and/or Libraries) to be used. A variable would then need to be defined on each developer's machine pointing to the common resources you use in your path.
Even better than Variables are Libraries. You can define custom libraries (under Window->Preferences->Java->Build Path->User Libraries
) to reference your common components, then reuse those libraries in each project. A configured library can be exported from the User Libraries
page and used by your peers.
Plugins such as m2eclipse provide Libraries (also know as Classpath Containers) that can automatically generate content based on some configuration (the Maven POM in m2eclipse's case). This abstracts the paths to underlying resources and allows multiple jars to be added to the path dynamically.
If you're not using Maven, the typical .classpath issue is that you want to add all jars in a folder to the classpath. This answer shows how it is possible to define a custom plugin to contribute all jars in a folder via a Classpath Container, you can also use this approach to automatically attach sources to the discovered elements and avoid having to repeat this effort each time.
Here is a typical before on the .classpath for a project I worked on recently. The library makes the configuration much lsess verbose, more portable, allows for reuse across projects, and defines the source attachments.
Before:
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/xml-apis.jar" sourcepath="C:/apache-ant-1.7.1/src/main"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant.jar" sourcepath="C:/apache-ant-1.7.1/src/main"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-antlr.jar" sourcepath="C:/apache-ant-1.7.1/src/main"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-apache-bcel.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-apache-bsf.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-apache-log4j.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-apache-oro.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-apache-regexp.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-apache-resolver.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-commons-logging.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-commons-net.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-jai.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-javamail.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-jdepend.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-jmf.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-jsch.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-junit.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-launcher.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-netrexx.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-nodeps.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-starteam.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-stylebook.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-swing.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-testutil.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-trax.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/ant-weblogic.jar"/>
<classpathentry kind="lib" path="C:/apache-ant-1.7.1/lib/xercesImpl.jar"/>
After:
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<!--all ant jars and source attachments defined here -->
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ant"/>