Skip to main content
Last updated July 08, 2011 12:26, by Aede
Feedicon  

Add a Medium

Introduction

The Maven Social Media Plugin is designed for extensibility. One can create a connection to social medium of choice without having to modify the plugin. Telling the plugin which implementation to load and adding it as a dependency is all there is to it.

Connector Interface

All of the on-board implementations implement the following Connector interface:

TODO: add interface

Simply create your own implementation and make sure Maven can find your implementation and depending classes. Read the Dependencies section for more information.

Dependencies

Your custom implementation needs to be on Maven's classpath. You can simply create your own artifact and install it in your local or corporate repository and define this dependency within the plugin configuration. For example:

<plugin>
  <groupId>nl.fizzit.maven.plugins</groupId>
  <artifactId>maven-social-media-plugin</artifactId>
  <version>1.0</version>
  <executions>
      <execution>
        ...
      </execution>
  </executions>
  <dependencies>
     <dependency>
        <groupId>your.stuff</groupId>
        <artifactId>social-media-connector</artifactId>
        <version>1.0</version>
     </dependency>
  </dependencies>
</plugin>

Another way is to keep your implementation within your project, but in a custom source directory. Then use Build Helper Maven Plugin to add this to Maven's classpath. Optionally filter out the content when your artifact is packaged. It most likely does not belong there.

in case your connector is a Maven artifact all of its dependencies should be defined in the corresponding pom. When for some reason you choose to keep the implementation within your project, all of its dependencies should be defines as is done in previous example.

Tell the Plugin to use your Connector

First the plugin needs to know the implementation class. You can define as many custom implementation as you want. The plugin stores the configuration in a Map called customConnectors. To add yours define it in the configuration section of the plugin:

<configurarion>
  <customConnectors>
    <nameOfYourConnector>your.stuff.socialmedia.Connector</nameOfYourConnector>
   </customConnectors>
</configurarion>

You can assign any name you like since it is backed by a map. It is used in the section where you tell the plugin to execute a goal. For example:

TODO: add example

Considerations

In case you think other people might find your connector useful, consider donating you solution to this project. Create a Jira ticket or contact one of the members with the Administrator role.

This projects is also open for new members if you like to contribute by adding and maintaining your implementation yourself.

 
 
Close
loading
Please Confirm
Close