Play Framework 2.1 Remove a core dependency

2019-05-28 22:11发布

since a few day now i'm trying to use Joda-time 1.6.2 on a play project. I know the play framework already come with the Joda-time 2.1 and it should be compatible with 1.6.2 according to joda-time site.

I'm trying to write an application that ask the user for a LocalDateTime and save the class with the attributes on a MongoDB using morphia.

I'm facing a problem, i have to use a class that are currently using joda-time 1.6.2 and i cannot change it dependency neither update it to 2.1. Since i have no use for the joda-Time 2.1, is it possible some how remove this dependency from Play Framework 2.1? so i can use 1.6.2? Or at least tell play i specifically only want to use the 1.6.2 version on my project?

I've tried so far:

  • Remove the jodatime folder from the cache dependencies (of course this wont work because it's always downloaded again).
  • Insert joda-time 1.6.2 on the project dependencies (both way manually and managed).
  • Search where the core dependencies are called so i can remove it (no luck so far).

Forgot to mention that the problem i'm facing is when the data arrive to morphia to be saved, i create a completely new and well formed class with 4 joda-time fields and keep getting this error:

[MappingException: Error mapping field:TimeOfDay.TimeStart] 

This happens in MorphiaObject.datastore.save(pAccess);

1条回答
爷、活的狠高调
2楼-- · 2019-05-28 22:54

i've been looking into dependency management too in this: Play Framework core dependency management/exclusion

and had a pointer in the right direction there.

basically you want to tinker in your Build.scala, and redefine your appDependencies with explicit deps and use .exclude(). you'll probably need to declare play itself as a dependency ( like in the link above ), then explicitly exclude the conflicing joda time.

you can also see what is bringing in each dependency in the play console with the 'dependencies' command.

查看更多
登录 后发表回答