Commit c0bfcbce authored by Brian Long's avatar Brian Long
Browse files

Merge branch 'develop' into stable

parents 714b848a 65a22509
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@ This is a maven plugin that provides directory/file merging/appending support to

| 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. |
| `merge-files`        | Copy all the files in each fileset into a target directory; appending contents of any duplicate filenames. |
| `merge-dirs`         | Copy all the directories in each fileset into a target directory; appending contents of duplicate filenames. |
| `append-files`       | Append all the files in each fileset into a target file. |

### Goal: `merge-files`

@@ -37,7 +37,7 @@ This is a maven plugin that provides directory/file merging/appending support to
| ---------------------- |:-----------:|:--------:| ------- | ----------- |
| `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. |
| `outputFileName`       | `string`    |          | `merged.txt` | The name of the file to output from the merged filesets; will be created in fileset output directory. |
| `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. |
+31 −19
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@
	</licenses>

	<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>
		<connection>scm:git:https://git.inteligr8.com/inteligr8/merge-maven-plugin.git</connection>
		<developerConnection>scm:git:git@git.inteligr8.com:inteligr8/merge-maven-plugin.git</developerConnection>
		<url>https://git.inteligr8.com/inteligr8/merge-maven-plugin</url>
	</scm>
	<organization>
		<name>Inteligr8</name>
@@ -42,19 +42,19 @@
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<maven.version>3.6.3</maven.version>
		<maven.version>3.9.11</maven.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.4</version>
			<version>3.20.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven.shared</groupId>
			<artifactId>file-management</artifactId>
			<version>3.0.0</version>
			<version>3.2.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
@@ -65,7 +65,7 @@
		<dependency>
			<groupId>org.apache.maven.plugin-tools</groupId>
			<artifactId>maven-plugin-annotations</artifactId>
			<version>3.6.0</version>
			<version>3.15.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
@@ -89,16 +89,32 @@
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<version>4.13.2</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<artifactId>maven-plugin-plugin</artifactId>
					<version>3.15.2</version>
				</plugin>
				<plugin>
					<artifactId>maven-invoker-plugin</artifactId>
					<version>3.9.1</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.plexus</groupId>
					<artifactId>plexus-component-metadata</artifactId>
					<version>2.2.0</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<artifactId>maven-plugin-plugin</artifactId>
				<version>3.6.0</version>
				<configuration>
					<goalPrefix>regex</goalPrefix>
				</configuration>
@@ -120,7 +136,6 @@
			<plugin>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-component-metadata</artifactId>
				<version>2.0.0</version>
				<executions>
					<execution>
						<goals>
@@ -131,7 +146,6 @@
			</plugin>
			<plugin>
				<artifactId>maven-invoker-plugin</artifactId>
				<version>3.2.2</version>
				<configuration>
					<projectsDirectory>${basedir}/src/it</projectsDirectory>
					<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
@@ -167,7 +181,6 @@
				<plugins>
					<plugin>
						<artifactId>maven-invoker-plugin</artifactId>
						<version>3.2.2</version>
						<executions>
							<execution>
								<id>run-its</id>
@@ -187,7 +200,7 @@
			</build>
		</profile>
		<profile>
			<id>ossrh-release</id>
			<id>central-publish</id>
			<build>
				<plugins>
					<plugin>
@@ -224,14 +237,13 @@
						</executions>
					</plugin>
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<version>1.6.13</version>
						<groupId>org.sonatype.central</groupId>
						<artifactId>central-publishing-maven-plugin</artifactId>
						<version>0.8.0</version>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>true</autoReleaseAfterClose>
							<publishingServerId>central</publishingServerId>
							<autoPublish>true</autoPublish>
						</configuration>
					</plugin>
				</plugins>
+6 −2
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.util.FileSetManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This class provides general merging support for other goals.
@@ -34,6 +36,8 @@ import org.apache.maven.shared.model.fileset.util.FileSetManager;
 */
public abstract class AbstractMergeMojo extends AbstractFileContentMojo {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    
	@Parameter( property = "filesets", required = true )
	protected List<FileSet> filesets;
    
@@ -42,7 +46,7 @@ public abstract class AbstractMergeMojo extends AbstractFileContentMojo {
			this.getLog().debug("merge " + (directory ? "directories" : "files"));
		
    	boolean didMerge = false;
		FileSetManager fsman = new FileSetManager(this.getLog());
		FileSetManager fsman = new FileSetManager(this.logger);
		Path basepath = this.project.getBasedir().toPath();
		
		try {
+5 −1
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.util.FileSetManager;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This goal appends all the files in the configured fileset and writes that
@@ -36,6 +38,8 @@ import org.codehaus.plexus.component.annotations.Component;
@Component( role = org.apache.maven.plugin.Mojo.class )
public class AppendFilesContentMojo extends AbstractFileContentMojo {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Parameter( property = "filesets", required = true )
	protected List<FileSet> filesets;

@@ -55,7 +59,7 @@ public class AppendFilesContentMojo extends AbstractFileContentMojo {
    private boolean appendContentInFileSet() throws MojoExecutionException {
    	int spacing = Math.max(this.includeHeader ? 1 : 0, this.spacing); 
    	boolean didMerge = false;
		FileSetManager fsman = new FileSetManager(this.getLog());
		FileSetManager fsman = new FileSetManager(this.logger);
		Path basepath = this.project.getBasedir().toPath();
		
		try {