{"id":7452,"date":"2014-06-19T03:58:45","date_gmt":"2014-06-19T03:58:45","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/19\/strange-compile-issue-with-maven-collection-of-common-programming-errors\/"},"modified":"2014-06-19T03:58:45","modified_gmt":"2014-06-19T03:58:45","slug":"strange-compile-issue-with-maven-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/19\/strange-compile-issue-with-maven-collection-of-common-programming-errors\/","title":{"rendered":"Strange compile issue with maven-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;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.<\/p>\n<p>Basically it&#8217;s complaining that it cannot find a class. However, the class is present in the maven classpath. I verified that after running <code>mvn<\/code> with the <code>-X<\/code> switch.<\/p>\n<pre><code>(see     612 [DEBUG]  \/home\/c\/.m2\/repository\/org\/apache\/camel\/camel-twitter\/2.11.0\/camel-twitter-2.11.0.jar ) below. \n<\/code><\/pre>\n<p>I even deleted my $HOME\/.m2 repository so that it would download everything again. But it still fails.<\/p>\n<p>Any idea what I&#8217;m missing here ?<\/p>\n<p>Here is my environment on Ubuntu.<\/p>\n<pre><code>mvn -version\nApache Maven 3.0.4\nMaven home: \/usr\/share\/maven\nJava version: 1.6.0_32, vendor: Sun Microsystems Inc.\nJava home: \/usr\/lib\/jvm\/jdk1.6.0_32\/jre\nDefault locale: en_US, platform encoding: UTF-8\nOS name: \"linux\", version: \"3.2.0-40-generic\", arch: \"amd64\", family: \"unix\"\n<\/code><\/pre>\n<p>Thanks.<\/p>\n<p>UPDATE (adding the imports in my Java class) Imports in my Java class (src\/main\/java\/&#8230;)<\/p>\n<pre><code>import org.apache.camel.Exchange;\nimport org.apache.camel.Processor;\nimport org.apache.camel.builder.RouteBuilder;\nimport org.apache.camel.component.twitter.TwitterComponent;\nimport org.apache.camel.component.websocket.WebsocketComponent;\n<\/code><\/pre>\n<p>Here is the stacktrace.<\/p>\n<pre><code>629 [ERROR] \/tmp\/jettycamelwebsocket\/src\/main\/java\/demo\/websocket\/TwitterStreamRoute.java:[27,55] incompatible types\n630 [ERROR] found   : org.apache.camel.Component\n631 [ERROR] required: org.apache.camel.component.twitter.TwitterComponent\n632 [ERROR]\n633 [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)\n634 [ERROR] -&gt; [Help 1]\n635 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\n636         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)\n637         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)\n638         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)\n639         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)\n640         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)\n641         at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)\n642         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)\n643         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)\n644         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)\n645         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)\n646         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)\n647         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)\n648         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n649         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\n650         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n651         at java.lang.reflect.Method.invoke(Method.java:597)\n652         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)\n653         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)\n654         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)\n655         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)\n656 Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure\n657         at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)\n658         at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)\n659         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)\n660         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)\n661         ... 19 more\n<\/code><\/pre>\n<p>Here is the output that shows the classpath.<\/p>\n<pre><code>$mvn -X clean install \n\n\n583 [DEBUG] Output directory: \/tmp\/jettycamelwebsocket\/target\/classes\n584 [DEBUG] Classpath:\n585 [DEBUG]  \/tmp\/jettycamelwebsocket\/target\/classes\n586 [DEBUG]  \/home\/c\/.m2\/repository\/org\/slf4j\/slf4j-api\/1.6.1\/slf4j-api-1.6.1.jar\n587 [DEBUG]  \/home\/c\/.m2\/repository\/org\/slf4j\/slf4j-log4j12\/1.6.1\/slf4j-log4j12-1.6.1.jar\n588 [DEBUG]  \/home\/c\/.m2\/repository\/log4j\/log4j\/1.2.16\/log4j-1.2.16.jar\n589 [DEBUG]  \/home\/c\/.m2\/repository\/org\/springframework\/spring-core\/3.2.2.RELEASE\/spring-core-3.2.2.RELEASE.jar\n590 [DEBUG]  \/home\/c\/.m2\/repository\/commons-logging\/commons-logging\/1.1.1\/commons-logging-1.1.1.jar\n591 [DEBUG]  \/home\/c\/.m2\/repository\/org\/springframework\/spring-web\/3.2.2.RELEASE\/spring-web-3.2.2.RELEASE.jar\n592 [DEBUG]  \/home\/c\/.m2\/repository\/aopalliance\/aopalliance\/1.0\/aopalliance-1.0.jar\n593 [DEBUG]  \/home\/c\/.m2\/repository\/org\/springframework\/spring-aop\/3.2.2.RELEASE\/spring-aop-3.2.2.RELEASE.jar\n594 [DEBUG]  \/home\/c\/.m2\/repository\/org\/springframework\/spring-beans\/3.2.2.RELEASE\/spring-beans-3.2.2.RELEASE.jar\n595 [DEBUG]  \/home\/c\/.m2\/repository\/org\/springframework\/spring-context\/3.2.2.RELEASE\/spring-context-3.2.2.RELEASE.jar\n596 [DEBUG]  \/home\/c\/.m2\/repository\/org\/springframework\/spring-webmvc\/3.2.2.RELEASE\/spring-webmvc-3.2.2.RELEASE.jar\n597 [DEBUG]  \/home\/c\/.m2\/repository\/org\/springframework\/spring-expression\/3.2.2.RELEASE\/spring-expression-3.2.2.RELEASE.jar\n598 [DEBUG]  \/home\/c\/.m2\/repository\/org\/apache\/camel\/camel-spring\/2.11.0\/camel-spring-2.11.0.jar\n599 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-server\/8.1.3.v20120416\/jetty-server-8.1.3.v20120416.jar\n600 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/orbit\/javax.servlet\/3.0.0.v201112011016\/javax.servlet-3.0.0.v201112011016.jar\n601 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-continuation\/8.1.3.v20120416\/jetty-continuation-8.1.3.v20120416.jar\n602 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-servlet\/8.1.3.v20120416\/jetty-servlet-8.1.3.v20120416.jar\n603 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-security\/8.1.3.v20120416\/jetty-security-8.1.3.v20120416.jar\n604 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-servlets\/8.1.3.v20120416\/jetty-servlets-8.1.3.v20120416.jar\n605 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-client\/8.1.3.v20120416\/jetty-client-8.1.3.v20120416.jar\n606 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-util\/8.1.3.v20120416\/jetty-util-8.1.3.v20120416.jar\n607 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-webapp\/8.1.3.v20120416\/jetty-webapp-8.1.3.v20120416.jar\n608 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-xml\/8.1.3.v20120416\/jetty-xml-8.1.3.v20120416.jar\n609 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-http\/8.1.3.v20120416\/jetty-http-8.1.3.v20120416.jar\n610 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-io\/8.1.3.v20120416\/jetty-io-8.1.3.v20120416.jar\n611 [DEBUG]  \/home\/c\/.m2\/repository\/org\/apache\/camel\/camel-core\/2.11.0\/camel-core-2.11.0.jar\n612 [DEBUG]  \/home\/c\/.m2\/repository\/org\/apache\/camel\/camel-twitter\/2.11.0\/camel-twitter-2.11.0.jar\n613 [DEBUG]  \/home\/c\/.m2\/repository\/org\/twitter4j\/twitter4j-core\/3.0.3\/twitter4j-core-3.0.3.jar\n614 [DEBUG]  \/home\/c\/.m2\/repository\/org\/twitter4j\/twitter4j-stream\/3.0.3\/twitter4j-stream-3.0.3.jar\n615 [DEBUG]  \/home\/c\/.m2\/repository\/org\/apache\/camel\/camel-websocket\/2.11.0\/camel-websocket-2.11.0.jar\n616 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-websocket\/7.6.8.v20121106\/jetty-websocket-7.6.8.v20121106.jar\n617 [DEBUG]  \/home\/c\/.m2\/repository\/org\/eclipse\/jetty\/jetty-jmx\/7.6.8.v20121106\/jetty-jmx-7.6.8.v20121106.jar\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;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&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7452","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7452"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7452\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}