Skip to content

Commit

Permalink
package POM files into GRAILS_HOME/lib
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Jun 6, 2014
1 parent 5cacb20 commit 5969732
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class GrailsBuildPlugin implements Plugin<Project> {
// of the dependencies in the given configuration(s)
project.ext {
sourcesFor = { configurations -> classifiedDependencies(project, configurations, "sources") }
pomFor = { configurations -> classifiedDependencies(project, configurations, "pom") }
javadocFor = { configurations -> classifiedDependencies(project, configurations, "javadoc") }
}
}
Expand Down Expand Up @@ -53,8 +54,13 @@ class GrailsBuildPlugin implements Plugin<Project> {
dependency.artifact { artifact ->
artifact.name = dependency.name
artifact.type = targetClassifier
artifact.extension = 'jar'
artifact.classifier = targetClassifier
if('pom' == targetClassifier) {
artifact.extension = 'pom'
}
else {
artifact.extension = 'jar'
artifact.classifier = targetClassifier
}
}
dependency
}
Expand Down
21 changes: 21 additions & 0 deletions gradle/assemble.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ task configurePopulateDependencies << {
libsConfigurations.each { configuration ->
def sourceArtifacts = sourcesFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }
def javadocArtifacts = javadocFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }
def pomArtifacts = pomFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }

for (artifact in configuration.resolvedConfiguration.resolvedArtifacts) {
if (artifact in seen) continue
seen << artifact
Expand All @@ -73,6 +75,25 @@ task configurePopulateDependencies << {
}
}

populateDependencies.into("$dependency.group/$dependency.name/jars") {
from artifact.file // this will trigger the actual download if necessary
def sourceJar = sourceArtifacts[dependency]
if (sourceJar) {
from sourceJar.file
}
def javadocJar = javadocArtifacts[dependency]
if (javadocJar) {
from javadocJar.file
}
}

populateDependencies.into("$dependency.group/$dependency.name") {
def pomFile = pomArtifacts[dependency]
if(pomFile) {
from pomFile.file
}
}

populateDependencies.from ("${metadata}/${dependency.group}/${dependency.name}/${dependency.version}") {
include "**/*ivy.xml"
eachFile { it.path = "$dependency.group/$dependency.name/ivy-${dependency.version}.xml" }
Expand Down

0 comments on commit 5969732

Please sign in to comment.