Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Fix #89: Keep compile dependencies scope also in pom.xml
Browse files Browse the repository at this point in the history
Due to a maven-publish plugin limitations all dependencies are set to runtime.
  • Loading branch information
Marcin Zajaczkowski committed Nov 20, 2014
1 parent 2873035 commit ee21c8f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ configure(srcSubprojects) {
from components.java
artifact sourcesJar
artifact javadocJar

//#89 - workaround to not to have only runtime dependencies in generated pom.xml
//Known limitation in maven-publish - - http://forums.gradle.org/gradle/topics/maven_publish_plugin_generated_pom_making_dependency_scope_runtime#reply_14120711
pom.withXml {
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
}
}
}
}
Expand Down

4 comments on commit ee21c8f

@mariuszs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very ugly hack... Why not maven-plugin? It works as expected.

@szpak
Copy link
Collaborator

@szpak szpak commented on ee21c8f Nov 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to integrate bintray plugin with maven-plugin?

@mariuszs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short not, but you can upload artifacts with gradle task.

@szpak
Copy link
Collaborator

@szpak szpak commented on ee21c8f Nov 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about fixing that in maven-publish on the upcoming hackathon, but looking in the code at that stage they seem to keep all dependencies as runtimeDependencies with no information about actual classifier. It would be probably (I hope I am wrong) a bigger change in the whole new publishing mechanism :(.

Please sign in to comment.