Skip to content

Commit

Permalink
add components.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
SentryMan committed Apr 20, 2024
1 parent 4c5f762 commit b94e0e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ This plugin uses the JDK 22 [Class-File API](https://openjdk.org/jeps/457). As t
<executions>
<execution>
<goals>
<!-- Will generate files that will disable avaje APT module-info spi validation -->
<goal>provides</goal>
<!-- Will disable avaje APT module-info spi validation -->
<!-- Will transform a module-info after compilation -->
<goal>module-spi</goal>
<goal>add-module-spi</goal>
</goals>
</execution>
</executions>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject</artifactId>
<version>9.12</version>
<version>10.0-RC2</version>
</dependency>
</dependencies>

Expand Down
8 changes: 2 additions & 6 deletions src/main/java/io/avaje/inject/mojo/ModuleSPIMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import java.lang.classfile.ClassFile;
import java.lang.classfile.ClassModel;
import java.lang.classfile.attribute.ModuleAttribute;
import java.lang.classfile.attribute.ModuleAttribute.ModuleAttributeBuilder;
import java.lang.classfile.attribute.ModuleProvideInfo;
import java.lang.classfile.attribute.ModuleRequireInfo;
import java.lang.classfile.constantpool.Utf8Entry;
import java.lang.classfile.attribute.ModuleAttribute.ModuleAttributeBuilder;
import java.lang.constant.ClassDesc;
import java.lang.constant.ModuleDesc;
import java.lang.reflect.AccessFlag;
Expand All @@ -33,14 +33,10 @@
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;

/** Plugin that transforms the project module-info class file to register META-INF/services. */
@Mojo(
name = "module-spi",
defaultPhase = LifecyclePhase.PROCESS_CLASSES,
requiresDependencyResolution = ResolutionScope.COMPILE)
@Mojo(name = "add-module-spi", defaultPhase = LifecyclePhase.PROCESS_CLASSES)
public class ModuleSPIMojo extends AbstractMojo {

private static final String IO_AVAJE_JSONB_PLUGIN = "io.avaje.jsonb.plugin";
Expand Down
25 changes: 25 additions & 0 deletions src/main/resources/META-INF/plexus/components.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>avaje-inject-maven-plugin</role-hint>
<configuration>
<id>avaje-provides-maven-plugin</id>
<phases>
<phase>avaje-inject-maven-plugin-not-used-phase</phase>
</phases>
<default-phases>
<process-sources>
io.avaje:avaje-inject-maven-plugin:10.0-RC2:provides
io.avaje:avaje-provides-maven-plugin:${project.version}:provides
</process-sources>
<process-classes>
io.avaje:avaje-provides-maven-plugin:${project.version}:add-module-spi
</process-classes>
</default-phases>
</configuration>
</component>
</components>
</component-set>

0 comments on commit b94e0e6

Please sign in to comment.