Should you provide dependent libraries in client jar?

前端 未结 5 629
眼角桃花
眼角桃花 2021-02-02 14:25

We\'re providing a client jar for other internal apps to connect to our app\'s REST API. Our API depends on a few standard Jakarta libraries. Is it a best practice to include

5条回答
  •  攒了一身酷
    2021-02-02 15:04

    You're expressing nervousness about very specific library version dependencies (and I can understand that, given how tightly coupled, say, Hibernate is between its different modules -- only certain versions of Hibernate-annotations work with one hibernate-core, which in turn must be used with a specific hibernate-validator).

    If you know a package needs to work as part of a much larger platform (say, as a plugin to a framework which may be loading its own jars), you really need the more powerful multi-versioned class-loading of OSGI (aka JSR-291): OSGI Technology

    With an OSGI-enabled framework, like Spring, Eclipse, Jonas, or Glassfish, you may specify in an XML file your specific version dependencies, and if you depend upon the bundle libfoo-1.1.4, while another plugin depends upon libfoo-2.0a, the OSGI dependency manager will ensure each loads the correct version.

提交回复
热议问题