Json2String Maven Plugin

Plugin removes useless whitespaces and newlines in target json files

License

License

Categories

Categories

Maven Build Tools JSON Data
GroupId

GroupId

com.github.unknownnpc.plugins
ArtifactId

ArtifactId

json-to-string-maven-plugin
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Json2String Maven Plugin
Plugin removes useless whitespaces and newlines in target json files
Project URL

Project URL

https://github.com/UnknownNPC/json-to-string-maven-plugin
Source Code Management

Source Code Management

https://github.com/unknownnpc/json-to-string-maven-plugin

Download json-to-string-maven-plugin

How to add to project

<plugin>
    <groupId>com.github.unknownnpc.plugins</groupId>
    <artifactId>json-to-string-maven-plugin</artifactId>
    <version>1.2</version>
</plugin>

Dependencies

compile (5)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.3.9
org.apache.maven : maven-core jar 3.3.9
com.fasterxml.jackson.core : jackson-core jar 2.8.7
com.fasterxml.jackson.core : jackson-databind jar 2.8.7
commons-io : commons-io jar 2.5

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.5

test (3)

Group / Artifact Type Version
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 3.3.0
org.apache.maven : maven-compat jar 3.3.9
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Build Status codecov Maven Central

json-compressor-maven-plugin

Overview

Plugin removes useless whitespaces and newlines in target json files. It helps to reduce file sizes before they get packaged.

Content

Install

Requires Java 1.7+ and Maven 3.x+

mvn clean install

Usage in pom.xml

<plugin>
	<groupId>com.github.unknownnpc.plugins</groupId>
	<artifactId>json-compressor</artifactId>
	<version>1.3</version>
	<executions>
		<execution>
			<goals>
				<goal>minify</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<includes>
			<include>${project.build.directory}/classes/large-file.json</include>
			<include>${project.build.directory}/classes/large-files-*.json</include>
		</includes>
		<excludes>
			<exclude>${project.build.directory}/classes/large-files-3.json</exclude>
		</excludes>
	</configuration>
</plugin>

Plugin is also support skip configuration parameter, eg. <configuration><skip>true</skip></configuration>.

Run

mvn com.github.unknownnpc.plugins:json-compressor:minify

Example

Before
{
    "id": 1,
    "name": "A green door",
    "price": 12.50,
    "tags": ["home", "green"]
}
After
{"id":1,"name":"A green door","price":12.5,"tags":["home","green"]}

Versions

Version
1.2
1.1