This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
67 lines (61 loc) · 1.97 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import org.gradle.api.tasks.TaskOutputs
plugins {
id 'java'
id 'maven-publish'
}
group 'no.nav.poc'
version '1.0-5'
publishing {
repositories {
maven {
url = uri("https://maven.pkg.github.com/navikt")
credentials {
username = System.getenv("GH_PACKAGES_USERNAME")
password = System.getenv("GH_PACKAGES_PASSWORD")
}
}
}
publications {
mavenJava(MavenPublication) {
pom {
name = "github-package-registry-gradle"
description = "A test project for the maven-publish plugin"
url = "https://github.com/navikt/github-package-registry-gradle"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
scm {
connection = "scm:git:https://github.com/navikt/github-package-registry-gradle.git"
developerConnection = "scm:git:https://github.com/navikt/github-package-registry-gradle.git"
url = "https://github.com/navikt/github-package-registry-gradle"
}
}
from components.java
}
}
}
tasks.create("generatePomPropertiesForJar") {
File outputDirectory = file("$buildDir/pom-properties")
outputDirectory.mkdirs()
File pomProperties = file("$outputDirectory/pom.properties")
pomProperties.text = """
#Generated by Gradle
#${new Date()}
groupId=${project.group}
artifactId=${project.name}
version=${project.version}
"""
outputs.file(pomProperties)
}
jar {
dependsOn("generatePomFileForMavenJavaPublication", "generatePomPropertiesForJar")
into("META-INF/maven/${project.group}/${project.name}") {
from(generatePomFileForMavenJavaPublication) {
rename(".+", "pom.xml")
}
from(generatePomPropertiesForJar)
}
}