Skip to content

Commit 4fec0fe

Browse files
authored
version 0.2.1 (#22)
1. use gradle 6.4 2. publish to maven central
1 parent 5e326b0 commit 4fec0fe

File tree

6 files changed

+139
-76
lines changed

6 files changed

+139
-76
lines changed

README.md

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,33 @@
88

99
## 项目状态
1010

11-
当前版本`0.2.0`为测试版本。请商户的专业技术人员在使用时注意系统和软件的正确性和兼容性,以及带来的风险。
11+
当前版本`0.2.1`为测试版本。请商户的专业技术人员在使用时注意系统和软件的正确性和兼容性,以及带来的风险。
1212

1313
## 环境要求
1414

1515
+ Java 1.8+
1616

1717
## 安装
1818

19+
最新版本已经在 [Maven Central](https://search.maven.org/artifact/com.github.wechatpay-apiv3/wechatpay-apache-httpclient) 发布。
20+
1921
### Gradle
2022

21-
在你的`build.gradle`文件中加入如下的信息
23+
在你的`build.gradle`文件中加入如下的依赖
2224

2325
```groovy
24-
repositories {
25-
...
26-
maven { url 'https://jitpack.io' }
27-
}
28-
...
29-
dependencies {
30-
implementation 'com.github.wechatpay-apiv3:wechatpay-apache-httpclient:0.1.6'
31-
...
32-
}
26+
implementation 'com.github.wechatpay-apiv3:wechatpay-apache-httpclient:0.2.1'
3327
```
3428

3529
### Maven
36-
37-
加入JitPack仓库
38-
39-
```xml
40-
<repositories>
41-
<repository>
42-
<id>jitpack.io</id>
43-
<url>https://jitpack.io</url>
44-
</repository>
45-
</repositories>
46-
```
47-
4830
加入以下依赖
4931

5032
```xml
51-
<dependency>
52-
<groupId>com.github.wechatpay-apiv3</groupId>
53-
<artifactId>wechatpay-apache-httpclient</artifactId>
54-
<version>0.2.0</version>
55-
</dependency>
33+
<dependency>
34+
<groupId>com.github.wechatpay-apiv3</groupId>
35+
<artifactId>wechatpay-apache-httpclient</artifactId>
36+
<version>0.2.1</version>
37+
</dependency>
5638
```
5739

5840
## 开始
@@ -202,14 +184,18 @@ CloseableHttpClient httpClient = WechatPayHttpClientBuilder.create()
202184

203185
### 我想使用以前的版本,要怎么办
204186

205-
可以在gradle中指定版本号。例如希望使用0.1.6版本,可以使用以下的方式
187+
之前的版本可以从 [jitpack](https://jitpack.io/#wechatpay-apiv3/wechatpay-apache-httpclient) 获取。例如希望使用0.1.6版本,gradle中可以使用以下的方式
206188

207-
```xml
208-
<dependency>
209-
<groupId>com.github.wechatpay-apiv3</groupId>
210-
<artifactId>wechatpay-apache-httpclient</artifactId>
211-
<version>0.1.6</version>
212-
</dependency>
189+
```groovy
190+
repositories {
191+
...
192+
maven { url 'https://jitpack.io' }
193+
}
194+
...
195+
dependencies {
196+
implementation 'com.github.wechatpay-apiv3:wechatpay-apache-httpclient:0.1.6'
197+
...
198+
}
213199
```
214200

215201
## 联系我们

build.gradle

Lines changed: 63 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
plugins {
22
id 'java-library'
3-
id 'maven'
3+
id 'maven-publish'
4+
id 'signing'
45
}
56

67
group 'com.github.wechatpay-apiv3'
7-
version '0.2.0'
8+
version '0.2.1'
89

910
sourceCompatibility = 1.8
1011
targetCompatibility = 1.8
@@ -14,12 +15,21 @@ repositories {
1415
}
1516

1617
ext {
18+
publishedArtifactId = project.name
19+
1720
httpclient_version = "4.5.12"
1821
slf4j_version = "1.7.30"
1922
junit_version = "4.12"
2023
jackson_version = "2.9.10"
2124
}
2225

26+
jar {
27+
manifest {
28+
attributes('Automatic-Module-Name': 'com.wechat.pay.contrib.apache.httpclient')
29+
attributes('Implementation-Version': project.version)
30+
}
31+
}
32+
2333
dependencies {
2434
api "org.apache.httpcomponents:httpclient:$httpclient_version"
2535
implementation "org.apache.httpcomponents:httpmime:$httpclient_version"
@@ -29,25 +39,60 @@ dependencies {
2939
testImplementation "junit:junit:$junit_version"
3040
}
3141

32-
jar {
33-
manifest {
34-
attributes('Implementation-Title': 'wechatpay-java',
35-
'Implementation-Version': project.version,
36-
'Export-Package': 'com.wechat.pay.*'
37-
)
42+
publishing {
43+
java {
44+
withJavadocJar()
45+
withSourcesJar()
3846
}
39-
}
4047

41-
task sourcesJar(type: Jar) {
42-
from sourceSets.main.allJava
43-
archiveClassifier.set("sources")
48+
publications {
49+
maven(MavenPublication) {
50+
artifactId = project.ext.publishedArtifactId
51+
from components.java
52+
53+
pom {
54+
name = project.name
55+
description = 'An Apache HttpClient decorator for WeChat Pay\'s API'
56+
url = 'https://github.com/wechatpay-apiv3/wechatpay-apache-httpclient'
57+
licenses {
58+
license {
59+
name = 'The Apache Software License, Version 2.0'
60+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
61+
}
62+
}
63+
developers {
64+
developer {
65+
name = 'WeChat Pay APIv3 Team'
66+
}
67+
}
68+
scm {
69+
connection = 'scm:git:https://github.com/wechatpay-apiv3/wechatpay-apache-httpclient.git'
70+
developerConnection = 'scm:git:ssh://github.com/wechatpay-apiv3/wechatpay-apache-httpclient.git'
71+
url = 'https://github.com/wechatpay-apiv3/wechatpay-apache-httpclient'
72+
}
73+
}
74+
}
75+
}
76+
77+
repositories {
78+
maven {
79+
name = "mavencentral"
80+
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
81+
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
82+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
83+
credentials {
84+
username System.getenv('SONATYPE_NEXUS_USERNAME')
85+
password System.getenv('SONATYPE_NEXUS_PASSWORD')
86+
}
87+
}
88+
}
4489
}
4590

46-
artifacts {
47-
archives sourcesJar
91+
signing {
92+
sign publishing.publications.maven
4893
}
4994

50-
wrapper {
51-
gradleVersion = "5.4.1"
52-
distributionType = Wrapper.DistributionType.ALL
53-
}
95+
96+
97+
98+

gradle/wrapper/gradle-wrapper.jar

2.67 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Mon Jun 03 16:31:01 CST 2019
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

gradlew

100644100755
Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"
@@ -66,6 +82,7 @@ esac
6682

6783
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6884

85+
6986
# Determine the Java command to use to start the JVM.
7087
if [ -n "$JAVA_HOME" ] ; then
7188
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
109126
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110127
fi
111128

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
129+
# For Cygwin or MSYS, switch paths to Windows format before running java
130+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
116134
JAVACMD=`cygpath --unix "$JAVACMD"`
117135

118136
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@ if $cygwin ; then
138156
else
139157
eval `echo args$i`="\"$arg\""
140158
fi
141-
i=$((i+1))
159+
i=`expr $i + 1`
142160
done
143161
case $i in
144-
(0) set -- ;;
145-
(1) set -- "$args0" ;;
146-
(2) set -- "$args0" "$args1" ;;
147-
(3) set -- "$args0" "$args1" "$args2" ;;
148-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154172
esac
155173
fi
156174

@@ -159,14 +177,9 @@ save () {
159177
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160178
echo " "
161179
}
162-
APP_ARGS=$(save "$@")
180+
APP_ARGS=`save "$@"`
163181

164182
# Collect all arguments for the java command, following the shell quoting and substitution rules
165183
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166184

167-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169-
cd "$(dirname "$0")"
170-
fi
171-
172185
exec "$JAVACMD" "$@"

gradlew.bat

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
117
@if "%DEBUG%" == "" @echo off
218
@rem ##########################################################################
319
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
1329
set APP_BASE_NAME=%~n0
1430
set APP_HOME=%DIRNAME%
1531

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
1635
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
36+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
1837

1938
@rem Find java.exe
2039
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
6584

6685
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
6786

87+
6888
@rem Execute Gradle
6989
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
7090

0 commit comments

Comments
 (0)