Plugin removes useless whitespaces and newlines in target json files. It helps to reduce file sizes before they get packaged.
Requires Java 1.7+ and Maven 3.x+
mvn clean install
<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>
.
mvn com.github.unknownnpc.plugins:json-compressor:minify
####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"]}