'Can an annotation processor make a new java module?

I am working on a tool for building modular projects, and one potential api for declaring external dependencies is for users to declare them directly on their module-info.java(s)

@Dependency(group="org.apache.commons", artifact="commons-lang3", version="3.12.0")
module jproject {
    requires java.base;
    requires jproject.annotations;

    // Should come from the dependency above...somehow
    requires org.apache.commons.lang3;
}

Bootstrap problem of getting jproject.annotations on the module-path aside, I suspect but have not yet confirmed that I could do the dependency resolution work here with an annotation processor.

javac --module-source-path modules/ 
      --module jproject
      --processor-path download_deps.jar
      -proc:only
      -d target/modules/

javac --module-source-path modules/ 
      --module jproject
      --processor-path ...
      -d target/modules/

What I can't figure is if its even conceptually possible to merge these two steps - calling javac and having a processor download the relevant files too a common place.

Looking at the Filer class available to processors I see createResource which feels like the right direction to dump downloaded jars that way, but I don't understand the compilation process enough to know if the filer's output would go on the module-path and if not if there is any way to do this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source