diff --git a/.gitignore b/.gitignore index 54a22a09..bd02a7e4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,7 @@ target .settings .springBeans .DS_Store +.gradle TODO +gradle.properties +build diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..b089be04 --- /dev/null +++ b/build.gradle @@ -0,0 +1,74 @@ +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1' + classpath 'com.github.jengelman.gradle.plugins:shadow:0.8' + classpath 'org.hidetake:gradle-ssh-plugin:0.3.12' + } +} + +ext { + libs = [ + slf4jApi: 'org.slf4j:slf4j-api:1.7.7', + jsonSmart: 'net.minidev:json-smart:2.0', + jacksonDatabind: 'com.fasterxml.jackson.core:jackson-databind:2.3.4', + gson: 'com.google.code.gson:gson:2.3', + hamcrestCore: 'org.hamcrest:hamcrest-core:1.3', + hamcrestLibrary: 'org.hamcrest:hamcrest-library:1.3', + + test: ['org.slf4j:slf4j-simple:1.7.7', 'org.assertj:assertj-core:1.6.1', 'commons-io:commons-io:2.4', 'org.hamcrest:hamcrest-core:1.3', 'org.hamcrest:hamcrest-library:1.3', 'junit:junit:4.10'] + + ] + snapshotVersion = true +} + +allprojects { + ext.displayName = null + + group = 'com.jayway.jsonpath' + version = '1.1.1' + (snapshotVersion ? "-SNAPSHOT" : "") + + if (JavaVersion.current().isJava8Compatible()) { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } + } +} + +subprojects { + apply plugin: 'java' + apply plugin: 'signing' + apply plugin: 'osgi' + + sourceCompatibility = 1.6 + targetCompatibility = 1.6 + + repositories { + mavenCentral() + } + + task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc + } + + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource + } + + signing { + required { !snapshotVersion && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives + } + + artifacts { + archives jar, javadocJar, sourcesJar + } +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.0' +} \ No newline at end of file diff --git a/gradle/publishMaven.gradle b/gradle/publishMaven.gradle new file mode 100644 index 00000000..39be8ca2 --- /dev/null +++ b/gradle/publishMaven.gradle @@ -0,0 +1,94 @@ +apply plugin: "maven" + +def basePom = { + project { + name project.displayName + packaging 'bundle' + description project.description + url 'https://github.com/jayway/JsonPath' + + licenses { + license { + name "The Apache Software License, Version 2.0" + url "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution "repo" + } + } + + scm { + url 'scm:git:git://github.com/jayway/JsonPath.git' + connection 'scm:git:git://github.com/jayway/JsonPath.git' + developerConnection 'scm:git:git://github.com/jayway/JsonPath.git' + } + + developers { + developer { + id 'kalle.stenflo' + name 'Kalle Stenflo' + email 'kalle.stenflo (a) gmail.com' + } + } + } +} + +def deployers = [] + +project.afterEvaluate { + configure(deployers) { + pom basePom + } +} + +install { + deployers << repositories.mavenInstaller +} + +uploadArchives { + deployers << repositories.mavenDeployer { + if (snapshotVersion) { + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + if (project.hasProperty("sonatypeOssUsername")) { + authentication(userName: sonatypeOssUsername, password: sonatypeOssPassword) + } + } + } else { + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + if (project.hasProperty("sonatypeOssUsername")) { + authentication(userName: sonatypeOssUsername, password: sonatypeOssPassword) + } + } + } + } +} + +def poms = deployers*.pom +def optionalDeps = [] +def providedDeps = [] +def internalDeps = [] + +ext { + modifyPom = { Closure modification -> + poms.each { + it.whenConfigured(modification) + } + } + optional = { optionalDeps << it; it } + provided = { providedDeps << it; it } + internal = { internalDeps << it; it } +} + +modifyPom { pom -> + optionalDeps.each { dep -> + pom.dependencies.find { it.artifactId == dep.name }.optional = true + } + providedDeps.each { dep -> + pom.dependencies.find { it.artifactId == dep.name }.scope = "provided" + } + internalDeps.each { dep -> + pom.dependencies.removeAll { it.artifactId == dep.name } + } + // no need to publish test dependencies + pom.dependencies.removeAll { it.scope == "test" } +} + +deployers*.beforeDeployment { signing.signPom(it) } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..b7612167 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..c8ece9a4 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu Oct 02 21:38:47 CEST 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..91a7e269 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/json-path-assert/build.gradle b/json-path-assert/build.gradle new file mode 100644 index 00000000..36f08900 --- /dev/null +++ b/json-path-assert/build.gradle @@ -0,0 +1,26 @@ +apply from: "$rootDir/gradle/publishMaven.gradle" + +displayName = "Json Path Assert" + +description = "Assertions on Json using JsonPath" + +jar { + baseName 'json-path-assert' + manifest { + attributes 'Implementation-Title': 'json-path-assert', 'Implementation-Version': version + } +} + +dependencies { + compile project(':json-path') + compile libs.hamcrestCore + compile libs.hamcrestLibrary + compile libs.slf4jApi + + testCompile libs.test + + //testCompile libs.assertjCore + //testCompile libs.commonsIo + //testCompile libs.junit + +} diff --git a/json-path-assert/pom.xml b/json-path-assert/pom.xml deleted file mode 100644 index 67816e6b..00000000 --- a/json-path-assert/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - 4.0.0 - - json-path-parent - com.jayway.jsonpath - 1.1.1-SNAPSHOT - - json-path-assert - json-path-assert - http://code.google.com/p/json-path/ - - - com.jayway.jsonpath - json-path - ${project.version} - - - - org.hamcrest - hamcrest-library - - - - org.hamcrest - hamcrest-core - - - - com.fasterxml.jackson.core - jackson-databind - true - - - diff --git a/json-path-web-test/build.gradle b/json-path-web-test/build.gradle new file mode 100644 index 00000000..b7719845 --- /dev/null +++ b/json-path-web-test/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'shadow' +apply plugin: 'application' + +mainClassName = 'com.jayway.jsonpath.web.boot.Main' + +jar { + baseName 'json-path-web-test' + manifest { + attributes 'Implementation-Title': 'json-path-web-test', + 'Implementation-Version': version, + 'Main-Class': mainClassName + } +} + +dependencies { + compile project(':json-path') + compile 'commons-io:commons-io:2.4' + compile libs.jacksonDatabind + compile 'io.fastjson:boon:0.25' + compile 'com.nebhale.jsonpath:jsonpath:1.2' + compile 'io.gatling:jsonpath_2.10:0.4.0' + compile 'org.eclipse.jetty:jetty-server:9.2.2.v20140723' + compile 'org.eclipse.jetty:jetty-webapp:9.2.2.v20140723' + compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.9.1' + compile('org.glassfish.jersey.media:jersey-media-json-jackson:2.9.1'){ + exclude module: 'jackson-annotations:com.fasterxml.jackson.core' + exclude module: 'jackson-core:com.fasterxml.jackson.core' + } +} \ No newline at end of file diff --git a/json-path-web-test/pom.xml b/json-path-web-test/pom.xml deleted file mode 100644 index c97be772..00000000 --- a/json-path-web-test/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - 4.0.0 - - com.jayway.jsonpath - json-path-parent - 1.1.1-SNAPSHOT - - - com.jayway.jsonpath - json-path-web-test - 1.1.1-SNAPSHOT - - - UTF-8 - 0.4.0 - 0.25 - - - - - - org.eclipse.jetty.aggregate - jetty-all - 9.2.0.v20140526 - - - org.glassfish.jersey.containers - jersey-container-servlet - 2.9.1 - - - org.glassfish.jersey.media - jersey-media-json-jackson - 2.9.1 - - - jackson-annotations - com.fasterxml.jackson.core - - - jackson-core - com.fasterxml.jackson.core - - - - - org.slf4j - slf4j-simple - runtime - - - - commons-io - commons-io - ${commons-io.version} - - - - - com.jayway.jsonpath - json-path - ${project.version} - - - - io.fastjson - boon - ${boon.version} - - - - com.nebhale.jsonpath - jsonpath - 1.2 - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - io.gatling - jsonpath_2.10 - ${gatling-jsonpath.version} - - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - com.jayway.jsonpath.web.boot.Main - - - - - - com.jolira - onejar-maven-plugin - 1.4.4 - - - - 0.97 - true - onejar - - - one-jar - - - - - - - diff --git a/json-path/build.gradle b/json-path/build.gradle new file mode 100644 index 00000000..c50b2cf6 --- /dev/null +++ b/json-path/build.gradle @@ -0,0 +1,31 @@ +apply from: "$rootDir/gradle/publishMaven.gradle" + +displayName = "Json Path" + +description = "Java port of Stefan Goessner JsonPath." + +jar { + baseName 'json-path' + manifest { + attributes 'Implementation-Title': 'json-path', 'Implementation-Version': version + } +} + +dependencies { + compile libs.jsonSmart + compile libs.jacksonDatabind, optional + compile libs.gson, optional + compile libs.slf4jApi + + testCompile libs.test + /* + testCompile libs.slf4jSimple + testCompile libs.assertjCore + testCompile libs.commonsIo + testCompile libs.hamcrestCore + testCompile libs.hamcrestLibrary + testCompile libs.junit + */ + +} + diff --git a/json-path/pom.xml b/json-path/pom.xml deleted file mode 100644 index ee22423b..00000000 --- a/json-path/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - 4.0.0 - - com.jayway.jsonpath - json-path-parent - 1.1.1-SNAPSHOT - - json-path - bundle - json-path - http://code.google.com/p/json-path/ - - - net.minidev - json-smart - - - com.fasterxml.jackson.core - jackson-databind - true - - - com.google.code.gson - gson - true - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 914ef71d..00000000 --- a/pom.xml +++ /dev/null @@ -1,302 +0,0 @@ - - - - 4.0.0 - - org.sonatype.oss - oss-parent - 7 - - com.jayway.jsonpath - json-path-parent - pom - 1.1.1-SNAPSHOT - https://github.com/jayway/JsonPath - json-path-parent-pom - Java JsonPath implementation - 2011 - - GitHub Issue Tracking - - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html - - - - - Kalle Stenflo - kalle.stenflo - Jayway - http://www.jayway.com - kalle.stenflo at gmail.com - +1 - - Developer - - - - - master - UTF-8 - - 1.7.7 - 4.10 - 2.4 - 1.3 - 2.3.4 - 2.0 - 1.6.1 - - - http://github.com/jayway/JsonPath/tree/${scm.branch} - scm:git:git://github.com/jayway/JsonPath.git - scm:git:ssh://git@github.com/jayway/JsonPath.git - - - - - JsonPath mailing-list - https://groups.google.com/forum/#!forum/jsonpath - - - - - json-path - json-path-assert - json-path-web-test - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.16 - - - debug - - - - - - - - - release - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - false - -Xdoclint:none - - - - org.apache.maven.plugins - maven-source-plugin - 2.1.2 - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.1 - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/dependencies/${project.version} - - false - false - true - - - - - - - - - - - - - - net.minidev - json-smart - ${json-smart.version} - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - com.google.code.gson - gson - 2.3 - - - - io.fastjson - boon - 0.23 - - - org.assertj - assertj-core - ${assertj.version} - test - - - - org.hamcrest - hamcrest-library - ${hamcrest.version} - - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - - - - commons-io - commons-io - ${commons-io.version} - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - - org.slf4j - slf4j-simple - ${slf4j.version} - - - - junit - junit - ${junit.version} - - - - - - - - - - org.slf4j - slf4j-api - - - - - - org.assertj - assertj-core - test - - - - commons-io - commons-io - test - - - - org.slf4j - slf4j-simple - test - - - - org.hamcrest - hamcrest-core - test - - - - org.hamcrest - hamcrest-library - test - - - - junit - junit - test - - - - diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..af00d41f --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name='json-path-parent' +include ':json-path', ':json-path-assert', ':json-path-web-test' \ No newline at end of file