Child pages
  • Plugin migration to Maven 3.1+ dependencies
Skip to end of metadata
Go to start of metadata
Status
 WIP
Version
Issue(s)
Sources
Developer(s)

Most important changes:

  • switch from Sonatype Aether to Eclipse Aether ( contains a package change in several Maven APIs)
  • support of JSR330 in plugins ( javax.inject)


Maven Prerequisite

Change the prerequisite to 3.1.1. In general we would like to say "Plugins are Maven 3.x-compatible", which would mean its value should be 3.1.0. However, if your plugin depends on asm, you'll get the wrong version with Maven 3.1.0, hence to prevent this, the prerequisite should be set to 3.1.1.

Dependencies

  • drop maven-artifact-transfer. It sole purpose was to make it possible for plugins to support both Sonatype Aether (Maven 3.0.x) and Eclipse Aether (Maven 3.1.0+  and rebranded to Maven Artifact Resolver for Maven 3.5.0+). The extra abstract layer of maven-artifact-transfer only adds complexity and a library that must be maintained. Once everything depends on Maven 3.1.0 we can archive maven-artifact-transfer.

Generating descriptors

For performance, Maven doesn't do classpath scanning. Instead Maven expects a descriptor containing all components.


With Maven 3.1.0+ we can switch from plexus-component-metadata to sisu-maven-plugin

pom.xml
        <plugin>
          <groupId>org.eclipse.sisu</groupId>
          <artifactId>sisu-maven-plugin</artifactId>
          <version>0.3.4</version>
          <executions>
            <execution>
              <id>index-project</id>
              <goals>
                <goal>main-index</goal>
                <goal>test-index</goal>
              </goals>
            </execution>
          </executions>
        </plugin>


Testing

In case org.apache.maven.plugin-testing:maven-plugin-testing is used, it should be changed to 3.1.0 to be Maven 3.1.0 compatible.

PlexusTestcase

In order to make it possible to test with javax.inject in unit tests, one might need to add the following:

    @Override
    protected void customizeContainerConfiguration( ContainerConfiguration configuration )
    {
        configuration.setClassPathScanning( "INDEX" );
    }