Skip to content

Commit e76d81d

Browse files
committed
Use java-library plugin and remove some usages of deprecated methods and properties
SVN r64954 |2020-01-14 16:26:40 +0000
1 parent 6b818d6 commit e76d81d

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

java/build.gradle

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
import org.labkey.gradle.plugin.LabKey
2+
import org.labkey.gradle.util.BuildUtils
3+
import org.labkey.gradle.util.GroupNames
4+
import org.labkey.gradle.task.PomFile
15

26
plugins {
7+
id 'java-library'
38
id 'java'
4-
id 'maven'
9+
id 'maven' // TODO this has been deprecated
510
id 'maven-publish'
611
}
712

@@ -12,29 +17,18 @@ def artifactPrefix = 'labkey-client-api'
1217
def description = "The client-side library for Java developers is a separate JAR from the LabKey Server code base. It can be used by any Java program, including another Java web application."
1318
def orgUrl = "http://www.labkey.org"
1419

15-
16-
17-
import org.labkey.gradle.plugin.LabKey
18-
import org.labkey.gradle.util.BuildUtils
19-
import org.labkey.gradle.util.GroupNames
20-
import org.labkey.gradle.task.PomFile
21-
22-
project.configurations {
23-
api.extendsFrom(compile) // added for use by PomFile task
24-
}
25-
2620
dependencies {
27-
compile "org.apache.httpcomponents:httpmime:${httpmimeVersion}"
28-
compile ("com.googlecode.json-simple:json-simple:${jsonSimpleVersion}")
21+
api "org.apache.httpcomponents:httpmime:${httpmimeVersion}"
22+
api ("com.googlecode.json-simple:json-simple:${jsonSimpleVersion}")
2923
{
3024
// exclude this because it gets in the way of our own JSON object implementations from server/api
3125
exclude group: "org.json", module:"json"
3226
}
33-
compile "net.sf.opencsv:opencsv:${opencsvVersion}"
27+
api "net.sf.opencsv:opencsv:${opencsvVersion}"
3428
}
3529

3630
jar {
37-
baseName artifactPrefix
31+
archiveBaseName.set(artifactPrefix)
3832

3933
sourceCompatibility = project.sourceCompatibility
4034
targetCompatibility = project.targetCompatibility
@@ -64,14 +58,14 @@ project.task("fatJar",
6458
{
6559
Jar jar ->
6660
jar.from sourceSets.main.output
67-
jar.from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }}
68-
jar.archiveBaseName = artifactPrefix
69-
jar.archiveVersion = project.version
61+
jar.from { configurations.default.collect { it.isDirectory() ? it : zipTree(it) }}
62+
jar.archiveBaseName.set(artifactPrefix)
63+
jar.setArchiveVersion(project.version)
7064
jar.classifier LabKey.FAT_JAR_CLASSIFIER
7165
jar.dependsOn project.tasks.jar
7266
jar.into('lib') {
7367
from tasks.jar
74-
from configurations.compile
68+
from configurations.default
7569
}
7670
}
7771
)
@@ -88,16 +82,16 @@ if (project.hasProperty('javaClientDir'))
8882
project.task('javadocJar', description: "Generate jar file of javadoc files", type: Jar) {Jar jar ->
8983
jar.from project.tasks.javadoc.destinationDir
9084
jar.group GroupNames.DISTRIBUTION
91-
jar.archiveBaseName = artifactPrefix
92-
jar.classifier LabKey.JAVADOC_CLASSIFIER
85+
jar.archiveBaseName.set(artifactPrefix)
86+
jar.archiveClassifier.set(LabKey.JAVADOC_CLASSIFIER)
9387
jar.dependsOn project.tasks.javadoc
9488
}
9589

9690
project.task('sourcesJar', description: "Generate jar file of source files", type: Jar) {Jar jar ->
9791
jar.from project.sourceSets.main.allJava
9892

9993
jar.group GroupNames.DISTRIBUTION
100-
jar.archiveBaseName = artifactPrefix
94+
jar.archiveBaseName.set(artifactPrefix)
10195
jar.classifier LabKey.SOURCES_CLASSIFIER
10296
}
10397

@@ -108,6 +102,7 @@ project.artifacts {
108102
}
109103

110104
Properties pomProperties = new Properties()
105+
pomProperties.put('groupId', project.group)
111106
pomProperties.put("ArtifactId", artifactPrefix)
112107
pomProperties.put("Organization", "LabKey")
113108
pomProperties.put("OrganizationURL", orgUrl)
@@ -124,12 +119,12 @@ pomProperties.put("LicenseURL", "http://www.apache.org/licenses/LICENSE-2.0.txt"
124119
// an ordering. And so we have two, which I really don't like.
125120
def pomConfig = {
126121
organization {
127-
name 'LabKey'
122+
name = 'LabKey'
128123
url orgUrl
129124
}
130125
licenses {
131126
license {
132-
name 'The Apache Software License, Version 2.0'
127+
name = 'The Apache Software License, Version 2.0'
133128
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
134129
distribution 'repo'
135130
}
@@ -142,7 +137,7 @@ def pomConfig = {
142137
developers {
143138
developer {
144139
id 'labkey-team'
145-
name 'The LabKey Development Team'
140+
name = 'The LabKey Development Team'
146141
organization 'LabKey.org'
147142
organizationUrl orgUrl
148143
}

0 commit comments

Comments
 (0)