Skip to content

Commit

Permalink
Fix artifact metadata in JAR
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Sep 28, 2018
1 parent d924408 commit e596325
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
28 changes: 11 additions & 17 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ task generateMinPom {
| <version>${project.version}</version>
|""".stripMargin('|')

def dependencyTemplate = { dep -> """
<dependency>
<groupId>$dep.group</groupId>
<artifactId>$dep.name</artifactId>
<version>$dep.version</version>
</dependency>
""".stripIndent(4)
def dependencyTemplate = { dep -> """| <dependency>
| <groupId>$dep.group</groupId>
| <artifactId>$dep.name</artifactId>
| <version>$dep.version</version>
| </dependency>""".stripMargin('|')
}

String deps = configurations.runtime.allDependencies.findAll({it.name!= 'unspecified'})
.collect({ dep -> dependencyTemplate(dep)}).join('')
.collect({ dep -> dependencyTemplate(dep)}).join('\n')

String pom = pomHeader
if (deps) {
Expand All @@ -55,6 +53,11 @@ task generateMinPom {

project.file("$buildDir/tmp/maven").mkdirs()
project.file("$buildDir/tmp/maven/pom.xml").text = pom
project.file("$buildDir/tmp/maven/pom.properties").text = """|# Generated by Gradle ${gradle.gradleVersion}
|version=${project.version}
|groupId=${project.group}
|artifactId=${project.name}
|""".stripMargin('|')
}
}

Expand All @@ -79,15 +82,6 @@ jar {
from(rootProject.files('.')) {
include 'LICENSE*'
}
from(rootProject.file('src/maven')) {
into "maven/${project.group}/${project.name}"
expand(
'gradle_version': gradle.gradleVersion,
'project_version': project.version,
'project_group': project.group,
'project_name': project.name,
)
}
from(file("$buildDir/tmp/maven")) {
into "maven/${project.group}/${project.name}"
}
Expand Down
4 changes: 0 additions & 4 deletions src/maven/pom.properties

This file was deleted.

0 comments on commit e596325

Please sign in to comment.