Netflix / astyanax

Cassandra Java Client
Apache License 2.0
1.04k stars 354 forks source link

cassandra-thrift Should be a Compile-time Dependency #583

Open Kurt-von-Laven opened 9 years ago

Kurt-von-Laven commented 9 years ago

astyanax-thrift 3.6.0 incorrectly lists cassandra-thrift as a runtime dependency rather than a compile-time dependency.

Here is the relevant excerpt from http://central.maven.org/maven2/com/netflix/astyanax/astyanax-thrift/3.6.0/astyanax-thrift-3.6.0.pom.

...
<dependency>
  <groupId>org.apache.cassandra</groupId>
  <artifactId>cassandra-thrift</artifactId>
  <version>2.0.12</version>
  <scope>runtime</scope>
</dependency>
...

The scope line should either be changed to <scope>compile</scope> or removed since compile is the default scope.

When I try to build an application following the getting started wiki the compiler chokes on the ThriftFamilyFactory.getInstance() call.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project eos-analytics: Compilation failure
[ERROR] [...] cannot access org.apache.cassandra.thrift.Cassandra
[ERROR] class file for org.apache.cassandra.thrift.Cassandra not found
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project [...]: Compilation failure
[...] cannot access org.apache.cassandra.thrift.Cassandra
  class file for org.apache.cassandra.thrift.Cassandra not found

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
[...] cannot access org.apache.cassandra.thrift.Cassandra
  class file for org.apache.cassandra.thrift.Cassandra not found

    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

In the meantime folks can work around this by adding cassandra-thrift as a compile-time dependency directly in their own pom.xml. If you already have cassandra-thrift installed you will be unable to reproduce this issue unless you first remove it (e.g., via mvn dependency:purge-local-repository).

RouHim commented 6 years ago

It's 2018 and i ran into the exact same problem.