Ant JunitTask update to support JDK9 modules

Alan Bateman Alan.Bateman at oracle.com
Thu Apr 28 11:22:23 UTC 2016


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")


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 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.

-Alan


More information about the jigsaw-dev mailing list