Skip to content

Commit d03e6e5

Browse files
Support more POM properties (#345)
1 parent 8c2ad66 commit d03e6e5

File tree

6 files changed

+133
-0
lines changed

6 files changed

+133
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
mavenCentral()
5+
google()
6+
}
7+
8+
dependencies {
9+
classpath "com.vanniktech:gradle-maven-publish-plugin:${System.getProperty("com.vanniktech.publish.version")}"
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
11+
}
12+
}
13+
14+
apply plugin: "java"
15+
apply plugin: "org.jetbrains.kotlin.jvm"
16+
apply plugin: "com.vanniktech.maven.publish"
17+
18+
apply from: "maven-publish.gradle"
19+
20+
dependencies {
21+
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10"
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<!-- This module was also published with a richer model, Gradle metadata, -->
4+
<!-- which should be used instead. Do not delete the following line which -->
5+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
6+
<!-- that they should prefer consuming it instead. -->
7+
<!-- do_not_remove: published-with-gradle-metadata -->
8+
<modelVersion>4.0.0</modelVersion>
9+
<groupId>com.example</groupId>
10+
<artifactId>test-artifact</artifactId>
11+
<version>1.0.0</version>
12+
<name>Best Dependency</name>
13+
<description>This is the best dependency ever.</description>
14+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin</url>
15+
<inceptionYear>20xx</inceptionYear>
16+
<licenses>
17+
<license>
18+
<name>The Apache Software License, Version 2.0</name>
19+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
20+
<distribution>repo</distribution>
21+
</license>
22+
</licenses>
23+
<developers>
24+
<developer>
25+
<id>jaredsburrows</id>
26+
<name>Jared Burrows</name>
27+
<email>jaredsburrows@gmail.com</email>
28+
</developer>
29+
</developers>
30+
<scm>
31+
<connection>scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git</connection>
32+
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
33+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin</url>
34+
</scm>
35+
<issueManagement>
36+
<system>github</system>
37+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/issues</url>
38+
</issueManagement>
39+
<dependencies>
40+
<dependency>
41+
<groupId>org.jetbrains.kotlin</groupId>
42+
<artifactId>kotlin-stdlib-jdk8</artifactId>
43+
<version>1.6.10</version>
44+
<scope>compile</scope>
45+
</dependency>
46+
</dependencies>
47+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
GROUP=com.example
2+
VERSION_NAME=1.0.0
3+
POM_ARTIFACT_ID=test-artifact
4+
5+
POM_NAME=Best Dependency
6+
POM_DESCRIPTION=This is the best dependency ever.
7+
POM_INCEPTION_YEAR=20xx
8+
POM_PACKAGING=jar
9+
POM_URL=https://github.com/vanniktech/gradle-maven-publish-plugin
10+
11+
POM_ISSUE_SYSTEM=github
12+
POM_ISSUE_URL=https://github.com/vanniktech/gradle-maven-publish-plugin/issues
13+
14+
POM_SCM_URL=https://github.com/vanniktech/gradle-maven-publish-plugin
15+
POM_SCM_CONNECTION=scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git
16+
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git
17+
18+
POM_LICENSE_NAME=The Apache Software License, Version 2.0
19+
POM_LICENSE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
20+
POM_LICENSE_DIST=repo
21+
22+
POM_DEVELOPER_ID=jaredsburrows
23+
POM_DEVELOPER_NAME=Jared Burrows
24+
POM_DEVELOPER_EMAIL=jaredsburrows@gmail.com
25+
26+
signing.keyId=B89C4055
27+
signing.password=test
28+
signing.secretKeyRingFile=test-secring.gpg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.vanniktech.maven.publish.test;
2+
3+
/**
4+
* Just a test class with Javadoc.
5+
*/
6+
public final class TestClass {
7+
/**
8+
* Main method which does something.
9+
*
10+
* @param args Command-line arguments passed to the program.
11+
*/
12+
public static void main(String[] args) {
13+
System.out.println("Hello World!");
14+
}
15+
}

plugin/src/integrationTest/kotlin/com/vanniktech/maven/publish/MavenPublishPluginIntegrationTest.kt

+10
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ class MavenPublishPluginIntegrationTest {
282282
assertPomContentMatches()
283283
}
284284

285+
@Test fun generatesArtifactsAndDocumentationOnFullPomProject() {
286+
setupFixture("full_pom_project")
287+
288+
val result = executeGradleCommands(TEST_TASK, "--stacktrace")
289+
290+
assertExpectedTasksRanSuccessfully(result)
291+
assertExpectedCommonArtifactsGenerated()
292+
assertPomContentMatches()
293+
}
294+
285295
@Test fun generatesArtifactsAndDocumentationOnOverrideVersionGroupProject() {
286296
setupFixture("override_version_group_project")
287297

plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt

+11
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ abstract class MavenPublishBaseExtension(
168168
pom.inceptionYear.set(inceptionYear)
169169
}
170170

171+
val issueManagementSystem = project.findOptionalProperty("POM_ISSUE_SYSTEM")
172+
val issueManagementUrl = project.findOptionalProperty("POM_ISSUE_URL")
173+
if (issueManagementSystem != null || issueManagementUrl != null) {
174+
pom.issueManagement {
175+
it.system.set(issueManagementSystem)
176+
it.url.set(issueManagementUrl)
177+
}
178+
}
179+
171180
val scmUrl = project.findOptionalProperty("POM_SCM_URL")
172181
val scmConnection = project.findOptionalProperty("POM_SCM_CONNECTION")
173182
val scmDeveloperConnection = project.findOptionalProperty("POM_SCM_DEV_CONNECTION")
@@ -208,12 +217,14 @@ abstract class MavenPublishBaseExtension(
208217
val developerId = project.findOptionalProperty("POM_DEVELOPER_ID")
209218
val developerName = project.findOptionalProperty("POM_DEVELOPER_NAME")
210219
val developerUrl = project.findOptionalProperty("POM_DEVELOPER_URL")
220+
val developerEmail = project.findOptionalProperty("POM_DEVELOPER_EMAIL")
211221
if (developerId != null || developerName != null || developerUrl != null) {
212222
pom.developers { developers ->
213223
developers.developer {
214224
it.id.set(developerId)
215225
it.name.set(developerName)
216226
it.url.set(developerUrl)
227+
it.email.set(developerEmail)
217228
}
218229
}
219230
}

0 commit comments

Comments
 (0)