-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
148 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
plugins { | ||
id "java-library" | ||
id "maven-publish" | ||
id "signing" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
google() | ||
} | ||
|
||
apply from: "ext.gradle" | ||
|
||
group rootProject.ext.groupId | ||
version rootProject.ext.version | ||
|
||
dependencies { | ||
testImplementation group: 'junit', name: 'junit', version: '4.12' | ||
|
||
api 'com.squareup.okhttp3:okhttp:4.9.0' | ||
api 'com.fasterxml.jackson.core:jackson-core:2.11.0' | ||
api 'com.fasterxml.jackson.core:jackson-databind:2.11.0' | ||
api 'com.google.code.gson:gson:2.8.6' | ||
api 'com.google.guava:guava:29.0-jre' | ||
implementation 'org.slf4j:slf4j-api:2.0.0-alpha1' | ||
implementation 'org.slf4j:slf4j-simple:2.0.0-alpha1' | ||
compileOnly 'org.jetbrains:annotations:19.0.0' | ||
} | ||
|
||
task replaceVersion() { | ||
ant.replaceregexp( | ||
file: "./src/main/java/com/yhy/http/pigeon/utils/Utils.java", | ||
match: "public final static String VERSION = \"(.+)\"", | ||
replace: "public final static String VERSION = \"${rootProject.ext.version}\"", | ||
flags: 'g', | ||
byline: "true" | ||
) | ||
} | ||
|
||
task sourceJar(type: Jar) { | ||
classifier "sources" | ||
from sourceSets.main.allJava | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier "javadoc" | ||
from javadoc.destinationDir | ||
} | ||
|
||
javadoc { | ||
description = "生成jar格式的javadoc。" | ||
// 只显示 protected 和 public 的类和成员 | ||
options.memberLevel = JavadocMemberLevel.PROTECTED | ||
options.author = true | ||
options.version = true | ||
options.header = project.name | ||
// 静默javadoc检查(比如不支持@date会报错等),jdk 8+ | ||
options.addStringOption('Xdoclint:none', '-quiet') | ||
// 防止本地打开中文乱码 | ||
options.addStringOption("charset", "UTF-8") | ||
// suppress warnings due to cross-module @see and @link references; | ||
// note that global 'api' task does display all warnings. | ||
logging.captureStandardError LogLevel.INFO | ||
// suppress "## warnings" message | ||
logging.captureStandardOutput LogLevel.INFO | ||
// 编码一定要配置否则直接出错 | ||
options.encoding = "UTF-8" | ||
options.charSet = "UTF-8" | ||
// java9 | ||
if (JavaVersion.current().isJava9Compatible()) { | ||
options.addBooleanOption('html5', true) | ||
} | ||
} | ||
|
||
compileJava.dependsOn replaceVersion | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
groupId = rootProject.ext.groupId | ||
artifactId = rootProject.ext.artifactId | ||
version = rootProject.ext.version | ||
from components.java | ||
|
||
pom { | ||
name = rootProject.ext.artifactId | ||
description = rootProject.ext.description | ||
url = "https://${rootProject.ext.url}" | ||
licenses { | ||
license { | ||
name = 'Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution = 'repo' | ||
comments = 'A business-friendly OSS license' | ||
} | ||
} | ||
developers { | ||
developer { | ||
name = 'yhyzgn' | ||
email = 'yhyzgn@gmail.com' | ||
url = "/~https://github.com/yhyzgn/" | ||
} | ||
} | ||
scm { | ||
url = "https://${rootProject.ext.url}.git" | ||
connection = "scm:git:https://${rootProject.ext.url}.git" | ||
developerConnection = "scm:git:https://${rootProject.ext.url}.git" | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name "oss" | ||
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
credentials { | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign publishing.publications.mavenJava | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ext { | ||
groupId = 'com.yhyzgn.http' | ||
artifactId = 'pigeon' | ||
version = '1.2.9' | ||
description = 'Java http proxy.' | ||
url = 'github.com/yhyzgn/pigeon' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'pigeon' |
Oops, something went wrong.