Permalink
Browse files

package POM files into GRAILS_HOME/lib

  • Loading branch information...
1 parent 5cacb20 commit 596973242491829e5fedc6edf412ef67c4aff073 @graemerocher graemerocher committed Jun 6, 2014
Showing with 29 additions and 2 deletions.
  1. +8 −2 buildSrc/src/main/groovy/org/grails/gradle/GrailsBuildPlugin.groovy
  2. +21 −0 gradle/assemble.gradle
@@ -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") }
}
}
@@ -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
}
@@ -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
@@ -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" }

0 comments on commit 5969732

Please sign in to comment.