Well ok, silly me really because I think it is now clear that the "proper answer" is that the module really needs to open the subdirectories.
opens dbmigration.postgres; opens dbmigration.mysql; So thanks and apologies Alan. It's all making sense to me now, unfortunately I got muddled by that error. Cheers, Rob. On Mon, 20 Sept 2021 at 21:58, Rob Bygrave <robin.bygr...@gmail.com> wrote: > *> "dbmigration" resources have not been copied into target/classes?* > > target/classes/dbmigration exists *BUT* ... now I noticed that > dbmigration only contained other sub-directories (which then contain the > resources). So putting an empty junk.txt file into dbmigration fixes the > problem. > > So if the resource path only contains subdirectories then we get the > InvalidModuleDescriptorException, > to open resource paths they need to contain at least one file "at the top > level". Hmmm, I'll have to ponder that - it seems pretty subtle. > > target/classes/dbmigration > ├── postgres *(directory)* > │ └── 1.0_initial.sql > │ └── idx_postgres.migrations > └── mysql *(directory)* > │ └── 1.0_initial.sql > │ └── idx_mysql.migrations > └── junk.txt > *<!-- ADDING THIS FIXES IT* > > > Cheers, Rob > > > On Mon, 20 Sept 2021 at 21:22, Alan Bateman <alan.bate...@oracle.com> > wrote: > >> On 20/09/2021 09:55, Rob Bygrave wrote: >> > Hi, >> > I have a case where I believe I have a module where I would like to use: >> > >> > opens {package}; >> > >> > ... *where {package} only contains resources*, there are no .class >> files in >> > {package}. Currently when {package} only contains resources, we get an >> > InvalidModuleDescriptorException error: >> > >> > Error occurred during initialization of boot layer >> > java.lang.module.FindException: Error reading module: >> > /home/rob/github/avaje/test-modules/target/classes >> > Caused by: java.lang.module.InvalidModuleDescriptorException: Package >> > dbmigration not found in module >> > >> > module test.modules { >> > ... >> > opens dbmigration; >> > } >> You can open a package that only contains resources. The directory >> structure above hints that this is a Maven project, it is possible that >> the "dbmigration" resources have not been copied into target/classes? >> >> -Alan >> >