我可以从Java模块中排除导出的包吗? [英] Can I exclude an exported package from a Java module?

查看:88
本文介绍了我可以从Java模块中排除导出的包吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


模块jta和java.sql导出包javax.transaction.xa到模块dom4j

Modules jta and java.sql export package javax.transaction.xa to module dom4j

As你可以看到,两个模块 jta java.sql 导出相同的包, javax。 transaction.xa 。但是, jta 中的包具有我需要的类,这些类在 java.sql 中不存在。我根本不需要 java.sql 模块,但我需要 java.sql.SQLException

As you can see, both modules jta and java.sql export the same package, javax.transaction.xa. However, the package in jta has classes that I require that are not present in java.sql. I would simply not require the java.sql module, but I need java.sql.SQLException.

是否可以通过导出 javax.transaction.xa来阻止 java.sql

Is it possible to prevent java.sql from exporting javax.transaction.xa?

推荐答案

JTA GitHub 读取以下内容以确认@Alan已在 comment -

The JTA GitHub reads the following in confirmation to what @Alan already pointed out in a comment -


这个独立的Java版本(TM)Java Transaction API(JTA),使用
Java平台模块系统自动模块名称
java.transaction 来匹配JDK 9中使用的模块名称。未来的
版本将包含完整的模块元数据。此外,
javax.transaction.xa 包现在归Java SE所有。

This standalone release of Java(TM) Java Transaction API (JTA), uses a Java Platform Module System "automatic" module name of java.transaction, to match the module name used in JDK 9. A future version will include full module metadata. Moreover javax.transaction.xa package is now owned by Java SE.

您可以使用Maven版本(例如)使用: -

You can use the version with Maven(e.g) using :-

<dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>javax.transaction-api</artifactId>
    <version>1.3</version>
</dependency>

这是发布说明 JTA1.3MR

此外 JEP 320:删除Java EE和CORBA模块 详细阐述 -

Additionally the JEP 320: Remove the Java EE and CORBA Modules elaborates on the same -


... javax.transaction.xa 包支持JDBC中的XA事务。
这个XA包
Java SE 9中的 java.sql 模块中的JDBC位于同一位置。因为 java.sql 模块不可升级,独立版本的JTA可能不会为
覆盖XA包的Java SE
版本

... The javax.transaction.xa package supports XA transactions in JDBC. This "XA package" is co-located with JDBC in the java.sql module in Java SE 9. Because the java.sql module is not upgradeable, it is not possible for a standalone version of JTA to override the Java SE version of the XA package

并进一步说明解决方案的可扩展性

and to further note for extensibility in your solution


...为了方便维护,Java SE中的XA包可能会在未来被转移到
不同的不可升级模块,但作为一个
架构问题,它将保留在Java SE中与JDBC一起用于
长期限...

...For ease of maintenance, the XA package in Java SE may be moved to a different non-upgradeable module in the future, but as an architectural matter it will remain in Java SE alongside JDBC for the long term...

按计划


在2018年初,JTA 1.3将被定义为仅包含CORBA
互操作包; JAR文件将相应更新。

In early 2018, JTA 1.3 will be defined to consist of just the CORBA interop package; the JAR file will be updated accordingly.

这篇关于我可以从Java模块中排除导出的包吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆