Working with OODT and Eclipse

Are you using OODT with Eclipse? Are you stuck trying to get the classpath set up, and your project working? Read on!

How to avoid "mvn eclipse:eclipse" building errors

  • If you would like your project to depend on the installed version (in your local maven repo) of oodt-commons and cas-metadata, then run the eclipse plug-in as such: mvn -Declipse.useProjectReferences=false eclipse:eclipse.
  • If you check out cas-catalog, but check out commons with project name commons, not oodt-commons, and metadata as metadata and not cas-metadata, you will end up build errors saying projects oodt-commons and cas-metadata can't be found.

If you see this error:

For maven 2.6 and higher when doing mvn eclipse:eclipse you might get the error: 'Cannot nest output folder metadata/target/testclasses/org/apache/oodt/cas/ metadata' inside output folder 'metadata/target/test-classes'
Because of this error, the test-classes directory will not have it's resource config files copied in and Eclipse IDE will fail it's JUnit tests because it fails to find this test resources in its classpath.
THE WORK-AROUND
Even if the error is there, you still can run components JUnit tests in Eclipse IDE by doing the following:

  1. mvn eclipse:eclipse
  2. mvn test
  3. (even if the tests fail) go to Eclipse IDE now and refresh your project, the unit-tests will now run, because mvn test has already set up test-classes directory.

WARNING TO WORK-AROUND
If you change the components code, unit-test code, resource config files, etc... in any way you must again run 'mvn clean test' (so that the test-classes directory gets re-populated with your updates) before your can run the unit-tests in Eclipse IDE with the updates.
WHEN WILL YOU SEE THIS ERROR
If pom.xml for the component you are using contains a <testResources> tag, then you will get this error. This is because by default the maven eclipse plug-in will create the first entry in the .classpath example above and then will create the second entry if your pom.xml has <testResources> which need to be copied.

A sample classpath file:

Here's an example classpath file for use in your Eclipse environment. This works with version 0.1-incubating.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="trunk/commons/src/main/java"/>
	<classpathentry kind="src" path="trunk/catalog/src/main/java"/>
	<classpathentry kind="src" path="trunk/catalog/src/main/resources"/>
	<classpathentry kind="src" path="trunk/catalog/src/main/bin"/>
	<classpathentry kind="src" path="trunk/catalog/src/testdata"/>
	<classpathentry kind="src" path="trunk/catalog/src/test"/>
	<classpathentry kind="src" path="trunk/xmlps/src/test/resources"/>
	<classpathentry kind="src" path="trunk/xmlps/src/test/java"/>
	<classpathentry kind="src" path="trunk/xmlps/src/main/conf"/>
	<classpathentry kind="src" path="trunk/xmlps/src/main/java"/>
	<classpathentry kind="src" path="trunk/product/src/test"/>
	<classpathentry kind="src" path="trunk/profile/src/main/java"/>
	<classpathentry kind="src" path="trunk/profile/src/testdata"/>
	<classpathentry kind="src" path="trunk/profile/src/test"/>
	<classpathentry kind="src" path="trunk/profile/src/main/dtd"/>
	<classpathentry kind="src" path="trunk/product/src/main/java"/>
	<classpathentry kind="src" path="trunk/product/src/main/conf"/>
	<classpathentry kind="src" path="trunk/grid/src/test"/>
	<classpathentry kind="src" path="trunk/grid/src/main/java"/>
	<classpathentry kind="src" path="trunk/grid/src/main/webapp"/>
	<classpathentry kind="src" path="trunk/crawler/src/test"/>
	<classpathentry kind="src" path="trunk/crawler/src/main/java"/>
	<classpathentry kind="src" path="trunk/crawler/src/main/resources"/>
	<classpathentry kind="src" path="trunk/curator/src/main/java"/>
	<classpathentry kind="src" path="trunk/pushpull/src/main/java"/>
	<classpathentry kind="src" path="trunk/pushpull/src/main/resources"/>
	<classpathentry kind="src" path="trunk/workflow/src/main/java"/>
	<classpathentry kind="src" path="trunk/workflow/src/testdata"/>
	<classpathentry kind="src" path="trunk/workflow/src/main/resources"/>
	<classpathentry kind="src" path="trunk/workflow/src/test"/>
	<classpathentry kind="src" path="trunk/xmlquery/src/main/java"/>
	<classpathentry kind="src" path="trunk/sso/src/main/java"/>
	<classpathentry kind="src" path="trunk/xmlquery/src/main/conf"/>
	<classpathentry kind="src" path="trunk/xmlquery/src/test"/>
	<classpathentry kind="src" path="trunk/xmlquery/src/main/dtd"/>
	<classpathentry kind="src" path="trunk/resource/src/main/java"/>
	<classpathentry kind="src" path="trunk/resource/src/testdata"/>
	<classpathentry kind="src" path="trunk/resource/src/main/resources"/>
	<classpathentry kind="src" path="trunk/resource/src/test"/>
	<classpathentry kind="src" path="trunk/filemgr/src/main/java"/>
	<classpathentry kind="src" path="trunk/filemgr/src/testdata"/>
	<classpathentry kind="src" path="trunk/filemgr/src/test"/>
	<classpathentry kind="src" path="trunk/filemgr/src/main/resources"/>
	<classpathentry kind="src" path="trunk/metadata/src/test"/>
	<classpathentry kind="src" path="trunk/metadata/src/testdata"/>
	<classpathentry kind="src" path="trunk/metadata/src/main/java"/>
	<classpathentry kind="src" path="trunk/commons/src/test"/>
	<classpathentry kind="src" path="trunk/pcs/input/src/main/java"/>
	<classpathentry kind="src" path="trunk/commons/src/testdata"/>
	<classpathentry kind="src" path="trunk/commons/src/main/resources"/>
	<classpathentry kind="src" path="trunk/pcs/input/src/test"/>
	<classpathentry kind="src" path="trunk/metadata/src/main/resources"/>
	<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar"/>
	<classpathentry kind="var" path="M2_REPO/xmlrpc/xmlrpc/2.0.1/xmlrpc-2.0.1.jar"/>
	<classpathentry kind="var" path="M2_REPO/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar"/>
	<classpathentry kind="var" path="M2_REPO/commons-pool/commons-pool/1.2/commons-pool-1.2.jar"/>
	<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/2.5.4/spring-core-2.5.4.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/2.0.8/spring-beans-2.0.8.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/2.0.8/spring-context-2.0.8.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/apache/tika/tika/0.3/tika-0.3.jar"/>
	<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.4/commons-io-1.4.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-core/2.0.0/lucene-core-2.0.0.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/safehaus/jug/jug/2.0.0/jug-2.0.0-asl.jar"/>
	<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6.0"/>
	<classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
	<classpathentry kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2.1/commons-fileupload-1.2.1.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/apache/cxf/cxf-rt-frontend-jaxrs/2.2.7/cxf-rt-frontend-jaxrs-2.2.7.jar"/>
	<classpathentry kind="var" path="M2_REPO/javax/ws/rs/jsr311-api/1.1/jsr311-api-1.1.jar"/>
	<classpathentry kind="var" path="M2_REPO/net/sf/json-lib/json-lib/2.3/json-lib-2.3-jdk15.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/1.8.1/geronimo-javamail_1.4_mail-1.8.1.jar"/>
	<classpathentry kind="var" path="M2_REPO/nekohtml/nekohtml/0.9.5/nekohtml-0.9.5.jar"/>
	<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
	<classpathentry kind="var" path="M2_REPO/com/hp/hpl/jena/jena/2.6.3/jena-2.6.3.jar"/>
	<classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/globus/cog-jglobus/1.8.0/cog-jglobus-1.8.0.jar"/>
	<classpathentry kind="var" path="M2_REPO/commons-net/commons-net/1.4.0/commons-net-1.4.0.jar"/>
	<classpathentry kind="var" path="M2_REPO/com/jcraft/jsch/0.1.42/jsch-0.1.42.jar"/>
	<classpathentry kind="var" path="M2_REPO/org/apache/tika/tika-core/0.8-SNAPSHOT/tika-core-0.8-20101028.140922-95.jar"/>
	<classpathentry kind="output" path="trunk/target/classes"/>
</classpath>
  • No labels