Skip to content

Commit debea4e

Browse files
committed
tweak gradle file
1 parent 36eb2e3 commit debea4e

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

build.gradle

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ plugins {
33
id 'java-library'
44
}
55

6+
plugins {
7+
id 'maven-publish'
8+
}
9+
610
// Package default
711
archivesBaseName = 'google-search-results-java'
812
version = '2.0.1'
913
group = 'serpapi'
1014

15+
// java version
16+
sourceCompatibility = 1.8
17+
targetCompatibility = 1.8
18+
1119
// Load repositories
1220
repositories {
13-
jcenter()
21+
// jcenter()
22+
mavenCentral()
1423
}
1524

1625
// compileTestJava {
@@ -26,12 +35,50 @@ dependencies {
2635

2736
// Mockito
2837
testImplementation 'org.mockito:mockito-core:3.6.28'
38+
39+
// javadoc markdown support doesn't work with modern java and gradle.
2940
}
3041

42+
// jar file content
3143
tasks.named('jar') {
3244
manifest {
3345
attributes('Implementation-Title': project.name,
3446
'Implementation-Version': project.version)
3547
}
3648
}
3749

50+
task sourcesJar(type: Jar, dependsOn: classes) {
51+
classifier = 'sources'
52+
from sourceSets.main.allSource
53+
}
54+
55+
task javadocJar(type: Jar, dependsOn: javadoc) {
56+
classifier = 'javadoc'
57+
from javadoc.destinationDir
58+
}
59+
60+
artifacts {
61+
archives sourcesJar
62+
archives javadocJar
63+
}
64+
65+
// To specify a license in the pom:
66+
publishing {
67+
publications {
68+
mavenJava(MavenPublication) {
69+
pom {
70+
licenses {
71+
license {
72+
name = 'MIT License'
73+
url = 'https://github.com/serpapi/google-search-results-java/blob/master/LICENSE'
74+
}
75+
}
76+
}
77+
}
78+
}
79+
}
80+
81+
wrapper {
82+
gradleVersion = "7.3.3"
83+
distributionType = Wrapper.DistributionType.ALL
84+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)