All Projects → francisdb → serviceloader-maven-plugin

francisdb / serviceloader-maven-plugin

Licence: Apache-2.0 license
Maven plugin for generating java serviceloader files

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to serviceloader-maven-plugin

mvn-jlink
Maven plugin to provide way to work with jlink tool in maven projects
Stars: ✭ 34 (-26.09%)
Mutual labels:  maven-plugin
jcabi-mysql-maven-plugin
MySQL Maven Plugin: starts MySQL server on pre-integration phase and shuts it down on post-integration phase
Stars: ✭ 34 (-26.09%)
Mutual labels:  maven-plugin
restdocs-spec
A maven plugin for generating Open API and Postman Collection specifications using Spring Restdocs.
Stars: ✭ 43 (-6.52%)
Mutual labels:  maven-plugin
plexus-compiler
Plexus compiler a layer on top of compilers and used by maven-compiler-plugin
Stars: ✭ 24 (-47.83%)
Mutual labels:  maven-plugin
ktlint-maven-plugin
Maven plugin for ktlint the Kotlin linter
Stars: ✭ 42 (-8.7%)
Mutual labels:  maven-plugin
buildnumber-maven-plugin
BuildNumber Maven Plugin
Stars: ✭ 53 (+15.22%)
Mutual labels:  maven-plugin
snyk-maven-plugin
Test and monitor your projects for vulnerabilities with Maven. This plugin is officially maintained by Snyk.
Stars: ✭ 64 (+39.13%)
Mutual labels:  maven-plugin
light-jpf
Lightweight Java Plugin Framework
Stars: ✭ 19 (-58.7%)
Mutual labels:  maven-plugin
boost
Boost Maven and Gradle plugins for MicroProfile development
Stars: ✭ 27 (-41.3%)
Mutual labels:  maven-plugin
impsort-maven-plugin
Java import sorter plugin. Sort your imps!
Stars: ✭ 31 (-32.61%)
Mutual labels:  maven-plugin
exists-maven-plugin
Check if artifact exists in remote maven repository
Stars: ✭ 39 (-15.22%)
Mutual labels:  maven-plugin
susel
Super charge the module aware service loader in Java 11
Stars: ✭ 21 (-54.35%)
Mutual labels:  serviceloader
requs
Controlled Natural Language for Requirements Specifications
Stars: ✭ 36 (-21.74%)
Mutual labels:  maven-plugin
dmn-check
A tool which performs static analyses on Decision Model Notation (DMN) files to detect bugs
Stars: ✭ 34 (-26.09%)
Mutual labels:  maven-plugin
docs-maven-skin
Minimalist HTML5 and Bootstrap based Maven Skin for using Maven Site as a documentation site.
Stars: ✭ 31 (-32.61%)
Mutual labels:  maven-plugin
gatling-maven-plugin
Gatling Plugin for Maven
Stars: ✭ 30 (-34.78%)
Mutual labels:  maven-plugin
mosec-maven-plugin
用于检测maven项目的第三方依赖组件是否存在安全漏洞。
Stars: ✭ 85 (+84.78%)
Mutual labels:  maven-plugin
webstart
www.mojohaus.org/webstart/
Stars: ✭ 27 (-41.3%)
Mutual labels:  maven-plugin
jaxws-maven-plugin
www.mojohaus.org/jaxws-maven-plugin/
Stars: ✭ 18 (-60.87%)
Mutual labels:  maven-plugin
protobuf-maven-plugin
Maven Plugin that executes the Protocol Buffers (protoc) compiler
Stars: ✭ 204 (+343.48%)
Mutual labels:  maven-plugin

Build status Maven Central

This maven plugin generates services files for the ServiceLoader introduced in Java 6 : https://docs.oracle.com/javase/9/docs/api/java/util/ServiceLoader.html

Use

for example:

<build>
  <plugins>
    <plugin>
      <groupId>eu.somatik.serviceloader-maven-plugin</groupId>
      <artifactId>serviceloader-maven-plugin</artifactId>
      <version>1.3.1</version>
      <configuration>
        <services>
          <param>com.foo.Dictionary</param>
          <param>com.foo.Operation</param>
        </services>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>generate</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

this will generate these files:

  • META-INF/services/com.foo.Dictionary
  • META-INF/services/com.foo.Operation

by scanning the generated classes and finding all non-abstract/non-interface implementations of the service interfaces. The plugin itself has no Java 6 dependency

Excludes / includes

Additionally it is possible to filter implementation classes via includes and excludes section in the configuration. The class name notation is the same as for the services section.

for example:

<build>
  <plugins>
    <plugin>
      <groupId>eu.somatik.serviceloader-maven-plugin</groupId>
      <artifactId>serviceloader-maven-plugin</artifactId>
      <version>1.3.1</version>
      <configuration>
        <services>
          <param>com.foo.Dictionary</param>
          <param>com.foo.Operation</param>
        </services>
        <includes>
          <include>*.RightClass*</include>
        </includes>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>generate</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

This should add only implementation classes that begin with RightClass*.

Missing Service Classes

The default action when a service class is missing is to fail the build. If you want to ignore this service, you can use the failOnMissingServiceClass option (true by default).

for example:

<build>
  <plugins>
    <plugin>
      <groupId>eu.somatik.serviceloader-maven-plugin</groupId>
      <artifactId>serviceloader-maven-plugin</artifactId>
      <version>1.3.1</version>
      <configuration>
      	<failOnMissingServiceClass>false</failOnMissingServiceClass>
        <services>
          <param>com.foo.MissingService</param>
        </services>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>generate</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Example

A example project is provided and can be run like this:

$ mvn clean install
...
[INFO] Generating service file .../example/target/classes/META-INF/services/eu.somatik.serviceloader.Operation
[INFO]   + eu.somatik.serviceloader.SimpleOperation
...

$ java -jar target/example-1.0-SNAPSHOT.jar
Found service implementation: eu.somatik.serviceloader.SimpleOperation@579a19fd
Hello world

Release

see http://central.sonatype.org/pages/apache-maven.html#performing-a-release-deployment-with-the-maven-release-plugin

Note: do export GPG_TTY=$(tty) first if you have gpg: signing failed: Inappropriate ioctl for device errors

mvn -P release release:clean release:prepare
mvn -P release release:perform
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].