Note: this repo is now archived due to a lack of activity in development of Flume.
A Maven plugin to generate archives that can be used as plugins in a Flume agent.
This plugin is available in the Maven 2 central repo. You can add it to your plugin simply by adding the following to your POM:
<plugin>
<groupId>com.github.jrh3k5</groupId>
<artifactId>flume-plugin-maven-plugin</artifactId>
<version>1.1</version> <!-- or latest version -->
</plugin>
You can find the latest version released here:
http://central.maven.org/maven2/com/github/jrh3k5/flume-plugin-maven-plugin/
This plugin assembles a .tar.gz with a lib/ and libext/ beneath a folder named for the given plugin name as part of the configuration (read below).
For example, if you've configured the plugin to create a plugin name "my-plugin" for the library "my-lib.jar" which depends on "a.jar" and "b.jar", the contents of the created .tar.gz file will be:
my-project-1.0-my-plugin-flume-plugin.tar.gz
|
+- my-plugin
|
+- lib/
| |
| +- my-lib.jar
+- libext/
|
+- a.jar
+- b.jar
This plugin provides the following goals.
The following goals are used for building assemblies.
Below are the actual plugin goals themselves.
This plugin takes a specified dependency and assembles that assembly and its runtime and compile dependencies into a .tar.gz file that matches the structure of a Flume plugin.
An example configuration of this might look like:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.jrh3k5</groupId>
<artifactId>test-project</artifactId>
<build>
<plugins>
<plugin>
<groupId>com.github.jrh3k5</groupId>
<artifactId>flume-plugin-maven-plugin</artifactId>
<executions>
<execution>
<id>build-hdfs-sink-plugin</id>
<goals>
<goal>build-dependency-plugin</goal>
</goals>
<configuration>
<dependency>
<groupId>org.apache.flume.flume-ng-sinks</groupId>
<artifactId>flume-hdfs-sink</artifactId>
</dependency>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.flume.flume-ng-sinks</groupId>
<artifactId>flume-hdfs-sink</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</project>
This will assemble a .tar.gz in your project's target directory called test-project-1.0-SNAPSHOT-flume-hdfs-sink-flume-plugin.tar.gz and attach it to your project for its deployment.
By default, the plugin name is the name of the dependency being packaged.
This plugin assembles your current project, rather than a dependency of it, and its dependencies into a .tar.gz archive that matches the structure of a Flume plugin. An example usage might look like:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.jrh3k5</groupId>
<artifactId>test-project</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>com.github.jrh3k5</groupId>
<artifactId>flume-plugin-maven-plugin</artifactId>
<executions>
<execution>
<id>build-project-plugin</id>
<goals>
<goal>build-project-plugin</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.flume.flume-ng-sinks</groupId>
<artifactId>flume-hdfs-sink</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
This will create an artifact called test-project-1.0-SNAPSHOT-flume-plugin.tar.gz and attach it to your project. It will contain the JAR produced by this project in the lib/ folder of the plugin and all of its runtime and compile dependencies in the libext/ directory. Take note that, even though JUnit is listed as a dependency of this project, it will be excluded because it is a test-scoped dependency.
By default, the plugin name will be the same as the project artifact ID (and is thus omitted from the final artifact name to avoid redundant naming).
The following goals share also the following configuration elements:
You can change the classifier suffix, plugin name (by default, inherited from the artifact ID of the project using the plugin), and whether or not the artifact is attached with the following configuration elements:
<configuration>
<!-- Turn off attaching the artifact to your project -->
<attach>false</attach>
<!-- Change the classifier suffix from "flume-plugin" -->
<classifierSuffix>different-classifier-suffix</classifierSuffix>
<!-- Change the plugin name -->
<pluginName>not-the-artifactId</pluginName>
</configuration>
You may wish to not package some artifacts with your plugin. You can exclude an artifact from the final assembly with the following configuration:
<configuration>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</configuration>
The above example will filter the slf4j-log4j12 artifact from the plugin assembly.
Starting with version 1.1 of the plugin, you can also specify a <classifier />
element in the <exclusion />
element to specify a classifier to be used to exclude an artifact by its classifier.