Ant JunitTask update to support JDK9 modules

Tomas Zezula tomas.zezula at oracle.com
Fri May 6 16:00:38 UTC 2016


Hi Alan,
> On 28 Apr 2016, at 13:22, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 27/04/2016 17:17, Tomas Zezula wrote:
>> As seen in the modulepath and classpath mixture thread there are many possibilities how to execute unit tests.
>> I've sumarised them on the ant-dev mailing list in the context of Apache Ant in http://mail-archives.apache.org/mod_mbox/ant-dev/201604.mbox/%3CAFE6C849-0622-44D1-9FF7-3A6CA4832F82@oracle.com%3E
>> As a result of the discussion I've created a pull request for Apache Ant JUnitTask to support JDK9 modules:
>> https://github.com/apache/ant/pull/18
> On the qualified export approach then one thing you say is that it requires compiling with a "single multi-module compilation". You are right that compiling MyLibrary with a qualified export to MyLibraryTests will require MyLibraryTests to be on the module source path but you should be able to compile them separately if you want, this should do it:
> 
> javac -modulesourcepath src -d mods $(find src/MyLibrary -name "*.java")
> javac -modulepath mods -d mods/MyLibraryTests $(find src/MyLibraryTests -name "*.java”)
Yes, this works.
The MyLibrary is compiled with -modulesourcepath src to make MyLibraryTests module resolvable from MyLibrary’s module-info.
> 
> 
> 
> On the split package issue then ant-junit and ant-junit4.jar does seem unusual. Do you know if they are in the same package because one needs package private access to something in the other?
I believe that they do not have package private dependencies. And the packaging comes  historically from the source layout. The sources are in the same package and then packed into ant-junit (the optional JUnitTask and Ant’s test runner) ant-junit4 (containing just the Adapter from JUnit 4 API to Ant 3.8 API).
> I have no interest in making the options more complicated but if you really want to then -Xpatch can patch automatic modules and so `-Xpatch:ant.junit=ant-junit4.jar` will eventually overlay the contents of ant-junit4.jar over module ant.junit.
Thanks Alan, it’s good to know this. These two jars are Ant implementation details, they were always put on classpath by Ant. I will try to keep them in the UNNAMED-MODULE. There is no need to
make them automatic modules because no one depends on them, they are only a test launcher.
— Tomas
> 
> -Alan



More information about the jigsaw-dev mailing list