FasterXML / jackson-module-scala

Add-on module for Jackson (https://github.com/FasterXML/jackson) to support Scala-specific datatypes
Apache License 2.0
502 stars 142 forks source link

Add apache karaf features to jackson #427

Closed steinarb closed 3 years ago

steinarb commented 5 years ago

This is the part of FasterXML/jackson-databind#2434 that relates to changes to the jackson-module-scala project.

steinarb commented 5 years ago

I'm not sure how to do this:

  1. sbt can't use the karaf-maven-plugin
  2. sbt don't use ~/.m2/repository out of the box (though it can be added and dependencies can be fetched from there)
  3. karaf doesn't use the sbt repository (though if the layout follows the maven local repo structure, it can be made to do so)
  4. and most importantly: I don't know sbt

I did verify that the project still builds with the karaf changes in place (i.e. the changes to dependency scope doesn't break the build). The verification consists of switching to 2.10.0-SNAPSHOT and add the local maven repo to the resolvers. and build with "sbt compile": 36f9f5b

pjfanning commented 5 years ago

sbt osgi-bundle produces a jar that has a META-INF/MANIFEST.MF with osgi settings.

For instance:

cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Bnd-LastModified: 1569097554542
Bundle-ManifestVersion: 2
Bundle-Name: com.fasterxml.jackson.module.jackson.module.scala
Bundle-SymbolicName: com.fasterxml.jackson.module.jackson.module.scala
Bundle-Version: 2.10.0.pr4-SNAPSHOT
Created-By: 11.0.4 (Azul Systems, Inc.)
Export-Package: com.fasterxml.jackson.module.scala;uses:="com.fasterxml.
 jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.cor
 e.type,com.fasterxml.jackson.databind,com.fasterxml.jackson.databind.de
 ser,com.fasterxml.jackson.databind.ser,com.fasterxml.jackson.databind.t
 ype,com.fasterxml.jackson.module.scala.deser,com.fasterxml.jackson.modu
 le.scala.introspect,com.fasterxml.jackson.module.scala.ser,scala,scala.
 collection,scala.collection.mutable,scala.reflect,scala.runtime";versio
 n="2.10.0.pr4-SNAPSHOT",com.fasterxml.jackson.module.scala.deser;uses:=
 "com.fasterxml.jackson.core,com.fasterxml.jackson.core.type,com.fasterx
 ml.jackson.databind,com.fasterxml.jackson.databind.deser,com.fasterxml.
 jackson.databind.deser.impl,com.fasterxml.jackson.databind.deser.std,co
 m.fasterxml.jackson.databind.jsontype,com.fasterxml.jackson.databind.ty
 pe,com.fasterxml.jackson.databind.util,com.fasterxml.jackson.module.sca
 la,com.fasterxml.jackson.module.scala.modifiers,com.fasterxml.jackson.m
 odule.scala.util,scala,scala.collection,scala.collection.generic,scala.
 collection.immutable,scala.collection.mutable,scala.math,scala.reflect,
 scala.runtime,scala.util";version="2.10.0.pr4-SNAPSHOT",com.fasterxml.j
 ackson.module.scala.experimental;uses:="com.fasterxml.jackson.annotatio
 n,com.fasterxml.jackson.core,com.fasterxml.jackson.databind,com.fasterx
 ml.jackson.databind.annotation,com.fasterxml.jackson.databind.cfg,com.f
 asterxml.jackson.databind.introspect,com.fasterxml.jackson.databind.jso
 nFormatVisitors,com.fasterxml.jackson.databind.jsonschema,com.fasterxml
 .jackson.databind.jsontype,com.fasterxml.jackson.databind.ser,com.faste
 rxml.jackson.databind.util,com.fasterxml.jackson.module.scala,scala,sca
 la.collection,scala.reflect";version="2.10.0.pr4-SNAPSHOT",com.fasterxm
 l.jackson.module.scala.introspect;uses:="com.fasterxml.jackson.annotati
 on,com.fasterxml.jackson.core,com.fasterxml.jackson.databind,com.faster
 xml.jackson.databind.annotation,com.fasterxml.jackson.databind.cfg,com.
 fasterxml.jackson.databind.introspect,com.fasterxml.jackson.databind.js
 ontype,com.fasterxml.jackson.databind.ser,com.fasterxml.jackson.databin
 d.util,com.fasterxml.jackson.module.scala,scala,scala.collection,scala.
 collection.immutable,scala.math,scala.reflect,scala.runtime,scala.util.
 matching";version="2.10.0.pr4-SNAPSHOT",com.fasterxml.jackson.module.sc
 ala.modifiers;uses:="com.fasterxml.jackson.databind,com.fasterxml.jacks
 on.databind.type,com.fasterxml.jackson.module.scala,scala.reflect";vers
 ion="2.10.0.pr4-SNAPSHOT",com.fasterxml.jackson.module.scala.ser;uses:=
 "com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.faster
 xml.jackson.databind,com.fasterxml.jackson.databind.introspect,com.fast
 erxml.jackson.databind.jsontype,com.fasterxml.jackson.databind.ser,com.
 fasterxml.jackson.databind.ser.impl,com.fasterxml.jackson.databind.ser.
 std,com.fasterxml.jackson.databind.type,com.fasterxml.jackson.databind.
 util,com.fasterxml.jackson.module.scala,com.fasterxml.jackson.module.sc
 ala.modifiers,scala,scala.collection,scala.reflect,scala.runtime,scala.
 util";version="2.10.0.pr4-SNAPSHOT",com.fasterxml.jackson.module.scala.
 util;uses:="com.fasterxml.jackson.databind,com.fasterxml.jackson.module
 .scala,scala,scala.collection.immutable,scala.collection.mutable,scala.
 reflect";version="2.10.0.pr4-SNAPSHOT"
Import-Package: com.fasterxml.jackson.annotation;version="[2.10,3)",com.
 fasterxml.jackson.core;version="[2.10,3)",com.fasterxml.jackson.core.ty
 pe;version="[2.10,3)",com.fasterxml.jackson.core.util;version="[2.10,3)
 ",com.fasterxml.jackson.databind;version="[2.10,3)",com.fasterxml.jacks
 on.databind.annotation;version="[2.10,3)",com.fasterxml.jackson.databin
 d.cfg;version="[2.10,3)",com.fasterxml.jackson.databind.deser;version="
 [2.10,3)",com.fasterxml.jackson.databind.deser.impl;version="[2.10,3)",
 com.fasterxml.jackson.databind.deser.std;version="[2.10,3)",com.fasterx
 ml.jackson.databind.introspect;version="[2.10,3)",com.fasterxml.jackson
 .databind.jsonFormatVisitors;version="[2.10,3)",com.fasterxml.jackson.d
 atabind.jsonschema;version="[2.10,3)",com.fasterxml.jackson.databind.js
 ontype;version="[2.10,3)",com.fasterxml.jackson.databind.ser;version="[
 2.10,3)",com.fasterxml.jackson.databind.ser.impl;version="[2.10,3)",com
 .fasterxml.jackson.databind.ser.std;version="[2.10,3)",com.fasterxml.ja
 ckson.databind.type;version="[2.10,3)",com.fasterxml.jackson.databind.u
 til;version="[2.10,3)",com.fasterxml.jackson.module.paranamer;version="
 [2.10,3)",com.thoughtworks.paranamer;version="[2.8,3)",scala;version="[
 2.12,3)",scala.collection;version="[2.12,3)",scala.collection.convert;v
 ersion="[2.12,3)",scala.collection.generic;version="[2.12,3)",scala.col
 lection.immutable;version="[2.12,3)",scala.collection.mutable;version="
 [2.12,3)",scala.math;version="[2.12,3)",scala.reflect;version="[2.12,3)
 ",scala.runtime;version="[2.12,3)",scala.runtime.java8;version="[2.12,3
 )",scala.util;version="[2.12,3)",scala.util.matching;version="[2.12,3)"
Tool: Bnd-2.1.0.20130426-122213
pjfanning commented 5 years ago

we could use https://github.com/sbt/sbt-osgi if we need to customise some of the osgi settings

steinarb commented 5 years ago

@pjfanning This issue isn't for creating an OSGi bundle, but for creating an XML file attached to the maven jar artifact (a karaf feature repository), that apache karaf uses to load an OSGi bundle and its runtime dependencies.

I know how to do this for the maven projects (see the issue https://github.com/FasterXML/jackson-databind/issues/2434 and issues linked to from that issue):

But I don't know how to do this for sbt. A google search tells me that maven plugins can't be used in sbt, and I can't find an equivalent for karaf-maven-plugin for sbt.

pjfanning commented 5 years ago

I don't think the scala module is as important to support as the databind module. It doesn't look (so far) like too many Scala developers use Karaf. We can look at this later if there is a demand for it. It should be easy enough to generate kar files.

steinarb commented 5 years ago

@pjfanning Ok. Good! :-)