Skip to content

Commit 8c02725

Browse files
committed
Move to Maven Central
1 parent 3c6fa4a commit 8c02725

File tree

4 files changed

+159
-63
lines changed

4 files changed

+159
-63
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Maven Publish
2+
3+
on:
4+
release:
5+
types:
6+
- released
7+
8+
jobs:
9+
maven-publish:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-java@v1
14+
with:
15+
java-version: 1.8
16+
- name: Publish
17+
uses: eskatos/gradle-command-action@v1
18+
with:
19+
arguments: publish
20+
env:
21+
sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
22+
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
23+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
24+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}

build.gradle.kts

Lines changed: 101 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,127 @@
1-
import java.util.*
1+
import de.marcphilipp.gradle.nexus.NexusPublishPlugin
2+
import java.time.Duration
3+
4+
val libVersion: String by project
5+
val poi_ooxmlVersion: String by project
6+
val ooxml_schemasVersion: String by project
7+
val sonatypeUsername: String? = project.findProperty("sonatypeUsername") as String? ?: System.getenv("sonatypeUsername")
8+
val sonatypePassword: String? = project.findProperty("sonatypeUsername") as String? ?: System.getenv("sonatypePassword")
29

310
plugins {
4-
kotlin("jvm") version "1.4.10"
5-
id("com.jfrog.bintray") version "1.8.4"
6-
`maven-publish`
11+
kotlin("jvm") version "1.6.10"
12+
id("org.jetbrains.dokka") version "1.5.0"
13+
id("io.codearte.nexus-staging") version "0.21.2"
14+
id("de.marcphilipp.nexus-publish") version "0.4.0"
15+
id("com.github.ben-manes.versions") version "0.38.0"
16+
signing
17+
jacoco
718
}
819

920
group = "com.apurebase"
10-
version = "1.1.2"
21+
version = libVersion
1122

1223
repositories {
13-
jcenter()
24+
mavenCentral()
1425
}
1526

1627
dependencies {
1728
implementation(kotlin("stdlib"))
1829

19-
api("org.apache.poi:poi-ooxml:4.1.2")
20-
implementation("org.apache.poi:ooxml-schemas:1.4")
30+
api("org.apache.pozi:poi-ooxml:${poi_ooxmlVersion}")
31+
implementation("org.apache.poi:ooxml-schemas:$ooxml_schemasVersion")
2132
}
2233

23-
val sourcesJar by tasks.creating(Jar::class) {
24-
archiveClassifier.set("sources")
25-
from(sourceSets.getByName("main").allSource)
26-
from("LICENCE") {
27-
into("META-INF")
34+
kotlin {
35+
apply<NexusPublishPlugin>()
36+
37+
nexusPublishing {
38+
repositories {
39+
sonatype()
40+
}
41+
clientTimeout.set(Duration.parse("PT10M")) // 10 minutes
2842
}
29-
}
3043

3144

45+
explicitApi()
3246

33-
val githubUrl = "https://github.com/aPureBase/ExcelDSL"
34-
35-
publishing {
36-
publications {
37-
create<MavenPublication>("excel-dsl") {
38-
groupId = project.group.toString()
39-
artifactId = project.name
40-
version = project.version.toString()
41-
from(components["java"])
42-
artifact(sourcesJar)
43-
44-
pom {
45-
packaging = "jar"
46-
name.set(rootProject.name)
47-
url.set(githubUrl)
48-
scm { url.set(githubUrl) }
49-
issueManagement { url.set("$githubUrl/issues") }
50-
licenses {
51-
license {
52-
name.set("MIT")
53-
url.set("$githubUrl/blob/master/LICENSE")
54-
}
55-
}
56-
developers {
57-
developer {
58-
id.set("jeggy")
59-
name.set("Jógvan Olsen")
60-
}
47+
tasks {
48+
test {
49+
useJUnitPlatform()
50+
doFirst {
51+
jvmArgs = listOf(
52+
"-javaagent:${classpath.find { it.name.contains("jmockit") }!!.absolutePath}"
53+
)
54+
}
55+
}
56+
dokkaHtml {
57+
outputDirectory.set(buildDir.resolve("javadoc"))
58+
dokkaSourceSets {
59+
configureEach {
60+
jdkVersion.set(8)
61+
reportUndocumented.set(true)
62+
platform.set(org.jetbrains.dokka.Platform.jvm)
6163
}
6264
}
6365
}
66+
wrapper {
67+
distributionType = Wrapper.DistributionType.ALL
68+
}
69+
closeRepository {
70+
mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray())
71+
}
72+
closeAndReleaseRepository {
73+
mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray())
74+
}
75+
}
76+
77+
78+
79+
80+
81+
val sourcesJar by tasks.creating(Jar::class) {
82+
classifier = "sources"
83+
from(sourceSets.main.get())
84+
}
85+
val dokkaJar by tasks.creating(Jar::class) {
86+
group = JavaBasePlugin.DOCUMENTATION_GROUP
87+
classifier = "javadoc"
88+
from(tasks.dokkaHtml)
6489
}
65-
}
66-
kotlin {
67-
explicitApi()
6890

69-
bintray {
70-
user = System.getenv("BINTRAY_USER")
71-
key = System.getenv("BINTRAY_KEY")
72-
73-
publish = true
74-
setPublications("excel-dsl")
75-
pkg.apply {
76-
repo = "apurebase"
77-
name = project.name
78-
setLicenses("MIT")
79-
setLabels("kotlin", "excel", "apache", "poi", "dsl")
80-
vcsUrl = githubUrl
81-
websiteUrl = githubUrl
82-
issueTrackerUrl = "$githubUrl/issues"
83-
version.apply {
84-
name = "${project.version}"
85-
released = "${Date()}"
91+
publishing {
92+
publications {
93+
create<MavenPublication>("maven") {
94+
artifactId = project.name
95+
from(components["java"])
96+
artifact(sourcesJar)
97+
artifact(dokkaJar)
98+
pom {
99+
name.set("ExcelDSL")
100+
description.set("A easy to use Kotlin DSL to build Excel documents")
101+
organization {
102+
name.set("aPureBase")
103+
url.set("https://apurebase.com/")
104+
}
105+
licenses {
106+
license {
107+
name.set("The Apache License, Version 2.0")
108+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
109+
}
110+
}
111+
developers {
112+
developer {
113+
id.set("jeggy")
114+
name.set("Jógvan Olsen")
115+
email.set("[email protected]")
116+
}
117+
}
118+
scm {
119+
connection.set("scm:git:https://github.com/aPureBase/ExcelDSL.git")
120+
developerConnection.set("scm:git:https://github.com/aPureBase/ExcelDSL.git")
121+
url.set("https://github.com/aPureBase/ExcelDSL/")
122+
tag.set("HEAD")
123+
}
124+
}
86125
}
87126
}
88127
}

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
kotlin.code.style=official
1+
libVersion=1.2.0
2+
3+
poi_ooxmlVersion=4.1.2
4+
ooxml_schemasVersion=1.4
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.apurebase.excel
2+
3+
import org.apache.poi.ss.usermodel.HorizontalAlignment.CENTER
4+
5+
fun main() {
6+
7+
8+
excel {
9+
10+
sheet {
11+
row {
12+
span = 2
13+
cellRegion(4) {
14+
row {
15+
span = 2
16+
cell("abc")
17+
}
18+
}
19+
cellRegion(3) {
20+
row {
21+
span = 3
22+
cell("next")
23+
}
24+
}
25+
}
26+
}
27+
28+
}
29+
30+
}

0 commit comments

Comments
 (0)