Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta2 Missing FromString annotation for joda/time/DateTime.class when compiling in Scala #4660

Closed
dbachelder opened this issue Jan 8, 2014 · 4 comments

Comments

@dbachelder
Copy link

I'm using "org.elasticsearch" % "elasticsearch" % "1.0.0.Beta2" in my scala project and hitting the following error on compile:

[info] Compiling 183 Scala sources to /home/dev/projects/core/target/scala-2.10/classes...
[warn] Class org.elasticsearch.common.joda.convert.FromString not found - continuing with a stub.
[warn] Caught: java.lang.NullPointerException while parsing annotations in /home/.ivy2/cache/org.elasticsearch/elasticsearch/jars/elasticsearch-1.0.0.Beta2.jar(org/elasticsearch/common/joda/time/DateTime.class)
[error] error while loading DateTime, class file '/home/.ivy2/cache/org.elasticsearch/elasticsearch/jars/elasticsearch-1.0.0.Beta2.jar(org/elasticsearch/common/joda/time/DateTime.class)' is broken
[error] (class scala.MatchError/p (of class java.lang.Character))
@dbachelder
Copy link
Author

Joda 2.3 has this in the pom

  <dependency>
      <groupId>org.joda</groupId>
      <artifactId>joda-convert</artifactId>
      <version>1.2</version>
      <scope>compile</scope>
      <optional>true</optional><!-- mandatory in Scala -->
    </dependency>

and I can see that the DateTime object is depending on one of the annotations found therein. So, I think for the ES stuff to work correctly in scala land, the joda-convert library will also need to be shaded into the final jar.

@dbachelder
Copy link
Author

The easy temporary fix is to create the missing file (org.elasticsearch.common.joda.convert.FromString) in my own project structure with the same contents as in the joda-convert project:

package org.elasticsearch.common.joda.convert;


import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.METHOD, ElementType.CONSTRUCTOR })
@Retention(RetentionPolicy.RUNTIME)
public @interface FromString {
}

@kimchy
Copy link
Member

kimchy commented Jan 8, 2014

I will fix it, will shard joda convert as well....

@kimchy kimchy closed this as completed in 0eaed0d Jan 8, 2014
kimchy added a commit that referenced this issue Jan 8, 2014
brusic pushed a commit to brusic/elasticsearch that referenced this issue Jan 19, 2014
@splatch
Copy link
Contributor

splatch commented Apr 1, 2014

I think scala is broken then - if annotation is missing on classpath it should be skipped. That's part of Java specification..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants