joda time 2.0

Showing 1-7 of 7 messages
joda time 2.0 jkriesten 8/5/11 12:09 AM

Hi,

I just tried to use joda time 2.0 (from the maven repo) with scala
2.9.0-1. It seems that the compiler can't analyze the lib:

[INFO] ...: info: compiling
[INFO] Compiling 3 source files to .../target/classes at 1312527976035
[ERROR] error: error while loading DateTime, Missing dependency 'class
org.joda.convert.FromString', required by
/Users/kriesten/.m2/repository/joda-time/joda-time/2.0/joda-time-2.0.jar(org/joda/time/DateTime.class)
[ERROR] error: error while loading AbstractInstant, Missing dependency
'class org.joda.convert.ToString', required by
/Users/kriesten/.m2/repository/joda-time/joda-time/2.0/joda-time-2.0.jar(org/joda/time/base/AbstractInstant.class)
[ERROR] .../Converter.scala:20: error: org.joda.time.DateTime does not
have a constructor
[INFO]     new DateTime( date )
[INFO]     ^
[ERROR] three errors found

This works fine with joda time 1.6.2. I double checked the 2.0 jar is
ok, also, the files can be decompiled fine using jad.

Any hint what might go wrong here?

Best regards, --- Jan.

Re: [scala-user] joda time 2.0 Jason Zaugg 8/5/11 12:18 AM
You need to explicitly include 'joda-convert', which is marked as a
optional dependency in the joda-time POM [1]

<dependency>
  <groupId>org.joda</groupId>
  <artifactId>joda-convert</artifactId>
  <version>1.1</version>
</dependency>

The Scala compiler requires that all classes referenced in signatures
of classes that you use are also available on the compile time
classpath.

-jason

[1] http://search.maven.org/remotecontent?filepath=joda-time/joda-time/2.0/joda-time-2.0.pom

Re: joda time 2.0 JodaStephen 8/6/11 4:18 AM
This library dependency should be optional. Annotations in Java are
optional - if they aren't found, the class still loads and runs.
Clearly Scala isn't respecting that.

I only included this in Joda-Time because of how Java annotations are
optional. No one should be forced to pick this up this as a
dependency. Can Scala be changed/fixed?

Stephen


On Aug 5, 8:18 am, Jason Zaugg <jza...@gmail.com> wrote:
> You need to explicitly include 'joda-convert', which is marked as a
> optional dependency in the joda-time POM [1]
>
> <dependency>
>   <groupId>org.joda</groupId>
>   <artifactId>joda-convert</artifactId>
>   <version>1.1</version>
> </dependency>
>
> The Scala compiler requires that all classes referenced in signatures
> of classes that you use are also available on the compile time
> classpath.
>
> -jason
>
> [1]http://search.maven.org/remotecontent?filepath=joda-time/joda-time/2....
Re: [scala-user] Re: joda time 2.0 Jason Zaugg 8/6/11 5:08 AM
On Sat, Aug 6, 2011 at 1:18 PM, JodaStephen <jodas...@gmail.com> wrote:
> This library dependency should be optional. Annotations in Java are
> optional - if they aren't found, the class still loads and runs.
> Clearly Scala isn't respecting that.
>
> I only included this in Joda-Time because of how Java annotations are
> optional. No one should be forced to pick this up this as a
> dependency. Can Scala be changed/fixed?

You only need it at compile time, use the "provided" scope in Maven for that.

-jason

Re: joda time 2.0 Tim P 8/14/11 1:01 AM
Has anyone any suggests as to what I can do about this as a user?
I'm compiling within intellij using the scala module.

The problem is that I get this;
 error while loading Period, Missing dependency 'class
org.joda.convert.FromString', required by C:\programmingExperiments
\joda-time-2.0\joda-time-2.0.jar(org/joda/time/Period.class)

repeated for each of the types at the top of the Make error list. It
doesn't tell me which or what I need to modify in order to make it go
away.
Does this mean I simply can't make it compile, or do I have to go
around importing org.joda.time.convert._into every scala file that
requires it?

Has anybody any interest in sorting this out? Or are you just going to
blame each other? Right now it looks like I've got to go back to a
previous version of jodatime, which is a shame because I do use joda
everywhere.

Tim

On Aug 6, 12:18 pm, JodaStephen <jodastep...@gmail.com> wrote:
> This library dependency should be optional. Annotations in Java are
> optional - if they aren't found, the class still loads and runs.
> Clearly Scala isn't respecting that.
>
> I only included this inJoda-Time because of how Java annotations are
> optional. No one should be forced to pick this up this as a
> dependency. Can Scala be changed/fixed?
>
> Stephen
>
> On Aug 5, 8:18 am, Jason Zaugg <jza...@gmail.com> wrote:
>
>
>
>
>
>
>
> > You need to explicitly include 'joda-convert', which is marked as a
> > optional dependency in thejoda-time POM [1]
>
> > <dependency>
> >   <groupId>org.joda</groupId>
> >   <artifactId>joda-convert</artifactId>
> >   <version>1.1</version>
> > </dependency>
>
> > The Scala compiler requires that all classes referenced in signatures
> > of classes that you use are also available on the compile time
> > classpath.
>
> > -jason
>
> > [1]http://search.maven.org/remotecontent?filepath=joda-time/joda-time/2....
>
> > On Fri, Aug 5, 2011 at 9:09 AM, Jan Kriesten <kries...@mail.footprint.de> wrote:
>
> > > Hi,
>
> > > I just tried to usejodatime 2.0 (from the maven repo) with scala
> > > 2.9.0-1. It seems that the compiler can't analyze the lib:
>
> > > [INFO] ...: info: compiling
> > > [INFO] Compiling 3 source files to .../target/classes at 1312527976035
> > > [ERROR] error: error while loading DateTime, Missing dependency 'class
> > > org.joda.convert.FromString', required by
> > > /Users/kriesten/.m2/repository/joda-time/joda-time/2.0/joda-time-2.0.jar(or g/joda/time/DateTime.class)
> > > [ERROR] error: error while loading AbstractInstant, Missing dependency
> > > 'class org.joda.convert.ToString', required by
> > > /Users/kriesten/.m2/repository/joda-time/joda-time/2.0/joda-time-2.0.jar(or g/joda/time/base/AbstractInstant.class)
> > > [ERROR] .../Converter.scala:20: error: org.joda.time.DateTime does not
> > > have a constructor
> > > [INFO]     new DateTime( date )
> > > [INFO]     ^
> > > [ERROR] three errors found
>
> > > This works fine withjodatime 1.6.2. I double checked the 2.0 jar is
Re: [scala-user] Re: joda time 2.0 Jason Zaugg 8/14/11 1:22 AM
Add this JAR to your classpath:

<dependency>
  <groupId>org.joda</groupId>
  <artifactId>joda-convert</artifactId>
  <version>1.1</version>
</dependency>

-jason

Re: [scala-user] Re: joda time 2.0 Meeraj Kunnumpurath 9/18/13 6:43 AM
This only works if the scope is not test. I am only using Scala for my test classes, but I am forced to add this as a provided dependency.