GithubHelp home page GithubHelp logo

linkerlin / serviceloader-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from francisdb/serviceloader-maven-plugin

0.0 2.0 0.0 130 KB

Maven plugin for generating java serviceloader files

License: Apache License 2.0

serviceloader-maven-plugin's Introduction

Build Status

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

for example:

<build>
  <plugins>
    <plugin>
      <groupId>eu.somatik.serviceloader-maven-plugin</groupId>
      <artifactId>serviceloader-maven-plugin</artifactId>
      <version>1.0.2</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

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

$ mvn2 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

The old project path for reference: http://jira.codehaus.org/browse/MOJO-1272?focusedCommentId=242147#action_242147

serviceloader-maven-plugin's People

Contributors

francisdb avatar jamescarter avatar justinsb avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.