diff --git a/chaincode/fabcar/java/build.gradle b/chaincode/fabcar/java/build.gradle index 37d2b3ae10..3b86398d75 100644 --- a/chaincode/fabcar/java/build.gradle +++ b/chaincode/fabcar/java/build.gradle @@ -4,8 +4,7 @@ plugins { id 'checkstyle' - id 'com.github.johnrengelman.shadow' version '2.0.4' - id 'java-library' + id 'java-library-distribution' id 'jacoco' } @@ -13,8 +12,9 @@ group 'org.hyperledger.fabric.samples' version '1.0-SNAPSHOT' dependencies { - implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-SNAPSHOT' + compileOnly 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-SNAPSHOT' implementation 'com.owlike:genson:1.5' + testImplementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-SNAPSHOT' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' testImplementation 'org.mockito:mockito-core:2.+' @@ -25,8 +25,8 @@ repositories { url "https://nexus.hyperledger.org/content/repositories/snapshots/" } jcenter() - maven { - url 'https://jitpack.io' + maven { + url 'https://jitpack.io' } } @@ -43,15 +43,6 @@ checkstyleTest { source ='src/test/java' } -shadowJar { - baseName = 'chaincode' - version = null - classifier = null - manifest { - attributes 'Main-Class': 'org.hyperledger.fabric.contract.ContractRouter' - } -} - jacocoTestCoverageVerification { afterEvaluate { classDirectories = files(classDirectories.files.collect { @@ -67,7 +58,7 @@ jacocoTestCoverageVerification { } } } - + finalizedBy jacocoTestReport } diff --git a/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.jar b/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.jar index 29953ea141..5c2d1cf016 100644 Binary files a/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.jar and b/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties b/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d70..7c4388a921 100644 --- a/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties +++ b/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/chaincode/fabcar/java/gradlew b/chaincode/fabcar/java/gradlew index cccdd3d517..83f2acfdc3 100755 --- a/chaincode/fabcar/java/gradlew +++ b/chaincode/fabcar/java/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/chaincode/fabcar/java/gradlew.bat b/chaincode/fabcar/java/gradlew.bat index e95643d6a2..24467a141f 100644 --- a/chaincode/fabcar/java/gradlew.bat +++ b/chaincode/fabcar/java/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @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 DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/chaincode/fabcar/java/settings.gradle b/chaincode/fabcar/java/settings.gradle index 4d04f71e08..8ee64221e6 100644 --- a/chaincode/fabcar/java/settings.gradle +++ b/chaincode/fabcar/java/settings.gradle @@ -2,4 +2,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -rootProject.name = 'java-chaincode-bootstrap' +rootProject.name = 'fabcar' diff --git a/fabcar/startFabric.sh b/fabcar/startFabric.sh index 48f4be3cad..a85769a165 100755 --- a/fabcar/startFabric.sh +++ b/fabcar/startFabric.sh @@ -22,7 +22,12 @@ if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then echo Finished vendoring Go dependencies elif [ "$CC_SRC_LANGUAGE" = "java" ]; then CC_RUNTIME_LANGUAGE=java - CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/java + CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/java/build/install/fabcar + echo Compiling Java code ... + pushd ../chaincode/fabcar/java + ./gradlew installDist + popd + echo Finished compiling Java code elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/javascript @@ -37,7 +42,7 @@ elif [ "$CC_SRC_LANGUAGE" = "typescript" ]; then echo Finished compiling TypeScript code into JavaScript else echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script - echo Supported chaincode languages are: go, javascript, and typescript + echo Supported chaincode languages are: go, java, javascript, and typescript exit 1 fi