JsonPath Maven Plugin

A maven plugin for evaluating JsonPath expressions

License

License

Categories

Categories

Maven Build Tools JSON Data JsonPath
GroupId

GroupId

ca.szc.maven
ArtifactId

ArtifactId

jsonpath-maven-plugin
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

JsonPath Maven Plugin
A maven plugin for evaluating JsonPath expressions
Project URL

Project URL

https://github.com/ASzc/jsonpath-maven-plugin
Source Code Management

Source Code Management

https://github.com/ASzc/jsonpath-maven-plugin

Download jsonpath-maven-plugin

How to add to project

<plugin>
    <groupId>ca.szc.maven</groupId>
    <artifactId>jsonpath-maven-plugin</artifactId>
    <version>1.2.0</version>
</plugin>

Dependencies

compile (2)

Group / Artifact Type Version
com.jayway.jsonpath : json-path jar 2.4.0
com.fasterxml.jackson.core : jackson-databind jar 2.10.3

provided (3)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.3.9
org.apache.maven : maven-core jar 3.3.9
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

Project Modules

There are no modules declared in this project.

jsonpath-maven-plugin: A maven plugin for evaluating JsonPath expressions

Overview

jsonpath-maven-plugin is an Apache 2.0 licensed maven plugin in Java 7.

Goal Examples

set-properties

This example uses the set-properties goal to set some maven properties from the information contained within a NPM package.json file.

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>ca.szc.maven</groupId>
                <artifactId>jsonpath-maven-plugin</artifactId>
                <version>1.2.0</version>
                <executions>
                    <execution>
                        <id>read-devdependencies</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>set-properties</goal>
                        </goals>
                        <configuration>
                            <file>package.json</file>
                            <properties>
                                <version.js.phantomjs-prebuilt>$.devDependencies.phantomjs-prebuilt</version.js.phantomjs-prebuilt>
                                <version.js.nsp>$.devDependencies.nsp</version.js.nsp>
                            </properties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

modify

This example uses the modify goal to change the version of a NPM package.json file.

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>ca.szc.maven</groupId>
                <artifactId>jsonpath-maven-plugin</artifactId>
                <version>1.2.0</version>
                <executions>
                    <execution>
                        <id>update-version</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>modify</goal>
                        </goals>
                        <configuration>
                            <file>${project.build.directory}/package.json</file>
                            <formatter>conventional</formatter>
                            <modifications>
                                <modification>
                                    <expression>$.version</expression>
                                    <value>${project.version}</value>
                                </modification>
                            </modifications>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Changelog

1.2.0

Change default pretty printer for modify goal, such that it returns output that is more conventional. Specify <formatter>jackson</formatter> for jackson's default formatter.

1.1.0

Support for indefinite paths in set-properties (Thanks @dpwrussell).

1.0.0

Initial release, with set-properties and modify goals.

Versions

Version
1.2.0
1.1.0
1.0.0