Skip to content

avaje/avaje-provides-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

181 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supported JVM Versions License Maven Central

Avaje Provides Maven Plugin

Maven plugin that post-processes module-info.class files after compilation to add all the required provides clauses for all services registered under META-INF/services as well as adding requires for certain avaje-inject plugins if applicable.

How to use

1. Add the plugin to your pom.xml

<plugin>
  <groupId>io.avaje</groupId>
  <artifactId>avaje-provides-maven-plugin</artifactId>
  <version>${version}</version> 
  <executions>
    <execution>
      <goals>
        <goal>disable-apt-validation</goal>
        <goal>add-module-spi</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Goals

add-module-spi

Given a module-info like:

module avaje.example {
  requires io.avaje.inject;

  requires static io.avaje.spi;

}

And a META-INF/services/my.example.SPIServiceInterface file (either manually created or generated by APT):

my.example.SPIServiceInterfaceImpl

This goal will transform the module-info classfile after compilation to roughly look like:

module avaje.example {
  requires io.avaje.inject;

  requires static io.avaje.spi;
  provides my.example.SPIServiceInterface with my.example.SPIServiceInterfaceImpl;
}

disable-apt-validation

As the add-module-spi goal must run after compilation, this goal generates a file before compilation that signals any apt project that uses avaje-prisms's ModuleInfoReader to not fail compilation on provides module validation.

About

module-info transformation via the classfile API

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages