swaldman / c3p0

a mature, highly concurrent JDBC Connection pooling library, with support for caching and reuse of PreparedStatements.
http://www.mchange.com/projects/c3p0
Other
1.28k stars 338 forks source link

Add Automatic-Module-Name to Manifest #171

Closed hohwille closed 6 months ago

hohwille commented 8 months ago

In order to be able to use C3Po in modern Java projects using JPMS, you need to provide a module name. Otherwise there is no reliable way to even import your classes such as com.mchange.v2.c3p0.ComboPooledDataSource in the Java-Module. Other connection pools like HikariCP or DBCP already support this.

http://branchandbound.net/blog/java/2017/12/automatic-module-name/

So if this project is still maintained, it would be awesome if you would provide module support. You do not have to move to Java9 and add a module-info.java adding something like this to your MAINFEST.MF will already be sufficient:

Automatic-Module-Name: com.mchange.c3po

Thanks for taking care.

hohwille commented 8 months ago

And for the record:

error: cannot access Referenceable
[ERROR]   class file for javax.naming.Referenceable not found

So just in case you ever consider adding a real module descriptor (module-info.java), you need to add

  requires java.naming;
swaldman commented 6 months ago

Thanks.

See https://github.com/swaldman/c3p0/commit/23d96e13d22eae22918199c6373689da04965338

It'll be a while before I add a real module descriptor. I'm still publishing Java 6 classfiles (while supporting JDK11 JDBC API). c3p0 was first released in 2002, and I try to break legacy apps as slowly as possible.

From the article you link, "Such an automatic module exports all of its packages and depends on all other resolved modules." I'm hoping that means people will be able to see Referenceable now?