From 654542acf302f215386d624e51c53163dc45c257 Mon Sep 17 00:00:00 2001 From: tlcfok Date: Tue, 28 Feb 2023 16:03:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3centos7=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8B=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决centos7环境下编译错误的问题,这个已经经过测试 --- build-hsm.gradle | 152 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 build-hsm.gradle diff --git a/build-hsm.gradle b/build-hsm.gradle new file mode 100644 index 000000000..d692dfd3c --- /dev/null +++ b/build-hsm.gradle @@ -0,0 +1,152 @@ +// Apply the java-library plugin to add support for Java Library +plugins { + id 'java' + id 'idea' + id 'java-library' + id 'jacoco' + //id 'com.github.sherter.google-java-format' version '0.8' + id 'maven-publish' + id 'org.ajoberstar.grgit' version '4.1.1' +} +println("Notice: current gradle version is " + gradle.gradleVersion) +// Additional attribute definition +ext { + // jackson version + javaSDKVersion="2.8.0-hsm" + solcJVersion = "0.4.25.1" + //solcJVersion = "0.5.2.0" + //solcJVersion = "0.6.10.0" + guavaVersion = "29.0-jre" + commonsCollections4Version = "4.4" +} + +archivesBaseName = 'java-sdk-demo' +version = '1.0.0' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +// In this section you declare where to find the dependencies of your project +repositories { + mavenCentral() + maven { url "https://maven.aliyun.com/nexus/content/groups/public/" } + maven { url "https://repo1.maven.org/maven2/" } + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } +} + +sourceSets { + main { + java { + srcDir 'src/main/java' + } + + resources { + srcDir 'src/main/resources' + } + } + integrationTest { + copy { + from file('src/test/resources/amop/') + into 'conf/amop' + } + java { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + srcDir file('src/integration-test/java') + } + resources.srcDir file('src/integration-test/resources') + } +} + + + + +//googleJavaFormat { +// options style: 'AOSP' + //source = sourceSets*.allJava +// include '**/*.java' +//} + + +//build.dependsOn(tasks.googleJavaFormat) +//verifyGoogleJavaFormat.mustRunAfter(tasks.googleJavaFormat) + +//verifyGoogleJavaFormat.dependsOn(tasks.googleJavaFormat) + +configurations { + integrationTestCompile.extendsFrom testCompile + integrationTestRuntime.extendsFrom testRuntime +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor 30, 'seconds' +} + +task integrationTest(type: Test) { + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath +} + +def spring_version = "5.3.17" +List spring = [ + "org.springframework:spring-core:$spring_version", + "org.springframework:spring-beans:$spring_version", + "org.springframework:spring-context:$spring_version", + "org.springframework:spring-tx:$spring_version", +] + +dependencies { + implementation ("org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:${javaSDKVersion}") + implementation ("org.fisco-bcos:solcJ:${solcJVersion}") + implementation ("com.google.guava:guava:${guavaVersion}") + implementation ("org.apache.commons:commons-collections4:${commonsCollections4Version}") + implementation spring +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor 30, 'seconds' +} + +javadoc { + options.addStringOption('Xdoclint:none', '-quiet') + options.addStringOption('encoding', 'UTF-8') + options.addStringOption('charSet', 'UTF-8') +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allJava + archiveClassifier = 'sources' +} + +task javadocJar(type: Jar) { + from javadoc + archiveClassifier = 'javadoc' +} + +jar { + // destinationDir file('dist/apps') + // archiveName project.name + '-' + project.version + '.jar' + exclude '**/*.xml' + exclude '**/*.properties' + doLast { + copy { + from file('build/libs/') + into 'dist/apps' + } + copy { + from configurations.runtimeClasspath + into 'dist/lib' + } + copy { + from file('src/test/resources/') + into 'dist/conf' + } + } +} +jacocoTestReport { + reports { + //xml.enabled true + //html.enabled false + } +} +check.dependsOn jacocoTestReport From eb9a374bca1c83973f98f6164109898e99856927 Mon Sep 17 00:00:00 2001 From: tlcfok Date: Tue, 28 Feb 2023 16:27:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3centos7=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8B=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=8D=87=E7=BA=A7gradle=20=E5=88=B08.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决centos7环境下编译错误的问题,升级gradle 到8.0.1 --- gradle/wrapper/gradle-wrapper.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4b442974..696cbdc8c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip +#distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists