added docs and prepped for maven central
This commit is contained in:
parent
95c8e68d0d
commit
3bd5030826
44
README.md
Normal file
44
README.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
# Directory Merge Maven Plugin
|
||||||
|
|
||||||
|
This is a maven plugin that provides directory/file merging/appending support to Maven.
|
||||||
|
|
||||||
|
## Goals
|
||||||
|
|
||||||
|
| Goal | Description |
|
||||||
|
| -------------------- | ----------- |
|
||||||
|
| `merge-files` | Merge the configured fileset of directories and their files into |
|
||||||
|
| `merge-dirs` | Apply a regular expression pattern against a set of property values, replacing matches with the specified text, and storing in new properties. |
|
||||||
|
| `append-files` | Apply a regular expression pattern against a property value, replacing matches with the specified text, and storing in a new property. |
|
||||||
|
|
||||||
|
### Goal: `merge-files`
|
||||||
|
|
||||||
|
| Configuration Property | Data Type | Required | Default | Description |
|
||||||
|
| ---------------------- |:-----------:|:--------:| ------- | ----------- |
|
||||||
|
| `filesets` | `FileSet[]` | Yes | | Executes against these files. |
|
||||||
|
| `chunkSize` | `int` | | `1024` | The streaming buffer/chunk size in bytes, while merging files. Adjust for classic speed/memory trade-off. |
|
||||||
|
| `encoding` | `string` | | `utf-8` | |
|
||||||
|
| `spacing` | `int` | | `0` | How much spacing between appended files. |
|
||||||
|
| `lineEnding` | `string` | | `\n` | Typically LF (`\n`) or CRLF (`\r\n`). |
|
||||||
|
|
||||||
|
### Goal: `merge-dirs`
|
||||||
|
|
||||||
|
| Configuration Property | Data Type | Required | Default | Description |
|
||||||
|
| ---------------------- |:-----------:|:--------:| ------- | ----------- |
|
||||||
|
| `filesets` | `FileSet[]` | Yes | | Executes against these files. |
|
||||||
|
| `chunkSize` | `int` | | `1024` | The streaming buffer/chunk size in bytes, while merging files. Adjust for classic speed/memory trade-off. |
|
||||||
|
| `encoding` | `string` | | `utf-8` | |
|
||||||
|
| `spacing` | `int` | | `0` | How much spacing between appended files. |
|
||||||
|
| `lineEnding` | `string` | | `\n` | Typically LF (`\n`) or CRLF (`\r\n`). |
|
||||||
|
|
||||||
|
### Goal: `append-files`
|
||||||
|
|
||||||
|
| Configuration Property | Data Type | Required | Default | Description |
|
||||||
|
| ---------------------- |:-----------:|:--------:| ------- | ----------- |
|
||||||
|
| `filesets` | `FileSet[]` | Yes | | Executes against these files. |
|
||||||
|
| `includeHeader` | `boolean` | | `false` | Should a header be added for each appended file? |
|
||||||
|
| `outputFileName` | `string` | | `merged.txt` | The file to output from the merged filesets. |
|
||||||
|
| `chunkSize` | `int` | | `1024` | The streaming buffer/chunk size in bytes, while merging files. Adjust for classic speed/memory trade-off. |
|
||||||
|
| `encoding` | `string` | | `utf-8` | |
|
||||||
|
| `spacing` | `int` | | `0` | How much spacing between appended files. |
|
||||||
|
| `lineEnding` | `string` | | `\n` | Typically LF (`\n`) or CRLF (`\r\n`). |
|
89
pom.xml
89
pom.xml
@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.inteligr8</groupId>
|
<groupId>com.inteligr8</groupId>
|
||||||
@ -10,9 +9,20 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<packaging>maven-plugin</packaging>
|
<packaging>maven-plugin</packaging>
|
||||||
|
|
||||||
<name>A Maven plugin for directory/file merge operations</name>
|
<name>Directory Merge Maven Plugin</name>
|
||||||
|
<description>A Maven plugin for directory/file merge operations</description>
|
||||||
|
<url>https://bitbucket.org/inteligr8/merge-maven-plugin</url>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007</name>
|
||||||
|
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
|
<connection>scm:git:https://bitbucket.org/inteligr8/merge-maven-plugin.git</connection>
|
||||||
|
<developerConnection>scm:git:git@bitbucket.org:inteligr8/merge-maven-plugin.git</developerConnection>
|
||||||
<url>https://bitbucket.org/inteligr8/merge-maven-plugin</url>
|
<url>https://bitbucket.org/inteligr8/merge-maven-plugin</url>
|
||||||
</scm>
|
</scm>
|
||||||
<organization>
|
<organization>
|
||||||
@ -142,19 +152,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>javadoc</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals><goal>jar</goal></goals>
|
|
||||||
<configuration>
|
|
||||||
<show>public</show>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
@ -189,14 +186,56 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>ossrh-release</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>source</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>jar-no-fork</goal></goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>javadoc</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals><goal>jar</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<show>public</show>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals><goal>sign</goal></goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
|
<version>1.6.13</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<serverId>ossrh</serverId>
|
||||||
|
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||||
|
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>inteligr8-releases</id>
|
|
||||||
<name>Inteligr8 Releases</name>
|
|
||||||
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -31,6 +31,11 @@ import org.apache.maven.plugin.MojoExecutionException;
|
|||||||
import org.apache.maven.plugins.annotations.Parameter;
|
import org.apache.maven.plugins.annotations.Parameter;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides general file content support for other goals.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
public abstract class AbstractFileContentMojo extends AbstractMojo {
|
public abstract class AbstractFileContentMojo extends AbstractMojo {
|
||||||
|
|
||||||
@Parameter( defaultValue = "${project}", readonly = true )
|
@Parameter( defaultValue = "${project}", readonly = true )
|
||||||
|
@ -27,6 +27,11 @@ import org.apache.maven.plugins.annotations.Parameter;
|
|||||||
import org.apache.maven.shared.model.fileset.FileSet;
|
import org.apache.maven.shared.model.fileset.FileSet;
|
||||||
import org.apache.maven.shared.model.fileset.util.FileSetManager;
|
import org.apache.maven.shared.model.fileset.util.FileSetManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides general merging support for other goals.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
public abstract class AbstractMergeMojo extends AbstractFileContentMojo {
|
public abstract class AbstractMergeMojo extends AbstractFileContentMojo {
|
||||||
|
|
||||||
@Parameter( property = "filesets", required = true )
|
@Parameter( property = "filesets", required = true )
|
||||||
|
@ -26,6 +26,12 @@ import org.apache.maven.shared.model.fileset.FileSet;
|
|||||||
import org.apache.maven.shared.model.fileset.util.FileSetManager;
|
import org.apache.maven.shared.model.fileset.util.FileSetManager;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This goal appends all the files in the configured fileset and writes that
|
||||||
|
* one resultant file to the configured output file.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
@Mojo( name = "append-files", threadSafe = true )
|
@Mojo( name = "append-files", threadSafe = true )
|
||||||
@Component( role = org.apache.maven.plugin.Mojo.class )
|
@Component( role = org.apache.maven.plugin.Mojo.class )
|
||||||
public class AppendFilesContentMojo extends AbstractFileContentMojo {
|
public class AppendFilesContentMojo extends AbstractFileContentMojo {
|
||||||
|
@ -18,6 +18,12 @@ import org.apache.maven.plugin.MojoExecutionException;
|
|||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This goal merges all the directories/files in the configured fileset,
|
||||||
|
* appending any duplicate files.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
@Mojo( name = "merge-dirs", threadSafe = true )
|
@Mojo( name = "merge-dirs", threadSafe = true )
|
||||||
@Component( role = org.apache.maven.plugin.Mojo.class )
|
@Component( role = org.apache.maven.plugin.Mojo.class )
|
||||||
public class MergeDirectoriesMojo extends AbstractMergeMojo {
|
public class MergeDirectoriesMojo extends AbstractMergeMojo {
|
||||||
|
@ -18,6 +18,12 @@ import org.apache.maven.plugin.MojoExecutionException;
|
|||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This goal merges all the files in the configured fileset, appending any
|
||||||
|
* duplicate files.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
@Mojo( name = "merge-files", threadSafe = true )
|
@Mojo( name = "merge-files", threadSafe = true )
|
||||||
@Component( role = org.apache.maven.plugin.Mojo.class )
|
@Component( role = org.apache.maven.plugin.Mojo.class )
|
||||||
public class MergeFilesMojo extends AbstractMergeMojo {
|
public class MergeFilesMojo extends AbstractMergeMojo {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user