Strange compile issue with maven-Collection of common programming errors

I’ve a Java project that just compiles fine on a Mac (OS-X Mountain Lion). When I try to compile the same project on an Ubuntu machine it fails.

Basically it’s complaining that it cannot find a class. However, the class is present in the maven classpath. I verified that after running mvn with the -X switch.

(see     612 [DEBUG]  /home/c/.m2/repository/org/apache/camel/camel-twitter/2.11.0/camel-twitter-2.11.0.jar ) below. 

I even deleted my $HOME/.m2 repository so that it would download everything again. But it still fails.

Any idea what I’m missing here ?

Here is my environment on Ubuntu.

mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_32, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/jdk1.6.0_32/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-40-generic", arch: "amd64", family: "unix"

Thanks.

UPDATE (adding the imports in my Java class) Imports in my Java class (src/main/java/…)

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.twitter.TwitterComponent;
import org.apache.camel.component.websocket.WebsocketComponent;

Here is the stacktrace.

629 [ERROR] /tmp/jettycamelwebsocket/src/main/java/demo/websocket/TwitterStreamRoute.java:[27,55] incompatible types
630 [ERROR] found   : org.apache.camel.Component
631 [ERROR] required: org.apache.camel.component.twitter.TwitterComponent
632 [ERROR]
633 [ERROR] /tmp/jettycamelwebsocket/src/main/java/demo/websocket/TwitterStreamRoute.java:[33,8] fromF(java.lang.String,java.lang.Object...    ) in org.apache.camel.builder.RouteBuilder cannot be applied to (java.lang.String,java.lang.String,java.lang.String)
634 [ERROR] -> [Help 1]
635 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:com    pile (default-compile) on project jettycamelwebsocket: Compilation failure
636         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
637         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
638         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
639         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
640         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
641         at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
642         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
643         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
644         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
645         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
646         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
647         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
648         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
649         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
650         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
651         at java.lang.reflect.Method.invoke(Method.java:597)
652         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
653         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
654         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
655         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
656 Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
657         at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
658         at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
659         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
660         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
661         ... 19 more

Here is the output that shows the classpath.

$mvn -X clean install 


583 [DEBUG] Output directory: /tmp/jettycamelwebsocket/target/classes
584 [DEBUG] Classpath:
585 [DEBUG]  /tmp/jettycamelwebsocket/target/classes
586 [DEBUG]  /home/c/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar
587 [DEBUG]  /home/c/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar
588 [DEBUG]  /home/c/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar
589 [DEBUG]  /home/c/.m2/repository/org/springframework/spring-core/3.2.2.RELEASE/spring-core-3.2.2.RELEASE.jar
590 [DEBUG]  /home/c/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
591 [DEBUG]  /home/c/.m2/repository/org/springframework/spring-web/3.2.2.RELEASE/spring-web-3.2.2.RELEASE.jar
592 [DEBUG]  /home/c/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
593 [DEBUG]  /home/c/.m2/repository/org/springframework/spring-aop/3.2.2.RELEASE/spring-aop-3.2.2.RELEASE.jar
594 [DEBUG]  /home/c/.m2/repository/org/springframework/spring-beans/3.2.2.RELEASE/spring-beans-3.2.2.RELEASE.jar
595 [DEBUG]  /home/c/.m2/repository/org/springframework/spring-context/3.2.2.RELEASE/spring-context-3.2.2.RELEASE.jar
596 [DEBUG]  /home/c/.m2/repository/org/springframework/spring-webmvc/3.2.2.RELEASE/spring-webmvc-3.2.2.RELEASE.jar
597 [DEBUG]  /home/c/.m2/repository/org/springframework/spring-expression/3.2.2.RELEASE/spring-expression-3.2.2.RELEASE.jar
598 [DEBUG]  /home/c/.m2/repository/org/apache/camel/camel-spring/2.11.0/camel-spring-2.11.0.jar
599 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-server/8.1.3.v20120416/jetty-server-8.1.3.v20120416.jar
600 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.jar
601 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-continuation/8.1.3.v20120416/jetty-continuation-8.1.3.v20120416.jar
602 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-servlet/8.1.3.v20120416/jetty-servlet-8.1.3.v20120416.jar
603 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-security/8.1.3.v20120416/jetty-security-8.1.3.v20120416.jar
604 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-servlets/8.1.3.v20120416/jetty-servlets-8.1.3.v20120416.jar
605 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-client/8.1.3.v20120416/jetty-client-8.1.3.v20120416.jar
606 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-util/8.1.3.v20120416/jetty-util-8.1.3.v20120416.jar
607 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-webapp/8.1.3.v20120416/jetty-webapp-8.1.3.v20120416.jar
608 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-xml/8.1.3.v20120416/jetty-xml-8.1.3.v20120416.jar
609 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-http/8.1.3.v20120416/jetty-http-8.1.3.v20120416.jar
610 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-io/8.1.3.v20120416/jetty-io-8.1.3.v20120416.jar
611 [DEBUG]  /home/c/.m2/repository/org/apache/camel/camel-core/2.11.0/camel-core-2.11.0.jar
612 [DEBUG]  /home/c/.m2/repository/org/apache/camel/camel-twitter/2.11.0/camel-twitter-2.11.0.jar
613 [DEBUG]  /home/c/.m2/repository/org/twitter4j/twitter4j-core/3.0.3/twitter4j-core-3.0.3.jar
614 [DEBUG]  /home/c/.m2/repository/org/twitter4j/twitter4j-stream/3.0.3/twitter4j-stream-3.0.3.jar
615 [DEBUG]  /home/c/.m2/repository/org/apache/camel/camel-websocket/2.11.0/camel-websocket-2.11.0.jar
616 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-websocket/7.6.8.v20121106/jetty-websocket-7.6.8.v20121106.jar
617 [DEBUG]  /home/c/.m2/repository/org/eclipse/jetty/jetty-jmx/7.6.8.v20121106/jetty-jmx-7.6.8.v20121106.jar