Closed fge closed 9 years ago
Do you have a small demo project? I can clone and test?
Sorry, I don't... Anyway, I have just found that one element of the packaging differs and that's in the Plugin-Dependencies
entries.
While the maven plugin generates "artifact-version.jar", this plugin generates "artifact:version.jar"... Maybe that explains it, I don't know; I have just modified the source and will try again.
I'll keep you informed.
Yeah when i write to the manifest i generate the entries here: https://github.com/iwarapter/gradle-sonar-packaging-plugin/blob/master/src/main/groovy/com/iadams/gradle/plugins/tasks/PackagePluginTask.groovy#L136
If the manifest is wrong thats where it will be from!
Also noticed this difference: META-INF/lib/grappa-2.0.0-beta.4-all.jar META-INF/lib/grappa-2.0.0-beta.4.jar
Spot on! I think it's the problem...
In module sonar-objectscript-squid:
dependencies {
compile(group: "com.github.fge", name: "grappa",
version: "2.0.0-beta.4", classifier: "all") {
exclude(group: "com.google.guava", module: "guava");
};
compile(group: "org.codehaus.sonar", name: "sonar-plugin-api",
version: "5.0.1");
compile(group: "org.codehaus.sonar.sslr-squid-bridge",
name: "sslr-squid-bridge", version: "2.6");
testCompile(group: "com.fasterxml.jackson.core",
name: "jackson-databind", version: "2.5.1");
}
Note the classifier
...
OK, so, anyway, this quick patch solves the problem of :
vs -
:
diff --git a/src/main/groovy/com/iadams/gradle/plugins/tasks/PackagePluginTask.groovy b/src/main/groovy/com/iadams/gradle/plugins/tasks/PackagePluginTask.groovy
index 0c9642e..d19dc56 100644
--- a/src/main/groovy/com/iadams/gradle/plugins/tasks/PackagePluginTask.groovy
+++ b/src/main/groovy/com/iadams/gradle/plugins/tasks/PackagePluginTask.groovy
@@ -133,7 +133,7 @@ class PackagePluginTask extends Jar {
if(!getSkipDependenciesPackaging()) {
List<ResolvedDependency> dependencies = new DependencyQuery(project).getNotProvidedDependencies()
- manifest.attributes.put(PluginManifest.DEPENDENCIES, dependencies.collect{ "META-INF/lib/${it.moduleName}:${it.moduleVersion}.jar" }.join(' '))
+ manifest.attributes.put(PluginManifest.DEPENDENCIES, dependencies.collect{ "META-INF/lib/${it.moduleName}-${it.moduleVersion}.jar" }.join(' '))
if(dependencies.size()>0){
logger.info "Following dependencies are packaged in the plugin:\n"
This and the classifier stuff should solve it all, I believe
OK, now I don't know how the problem should be solved; the maven plugin, somehow, picked the correct dependency but renamed it! While the gradle plugin picked it as is but only accounted for the name and version and not a potential qualifier...
I suck at groovy, which doesn't help matters; but there are potentially two solutions:
I'll try and do the second solution since it will be easier for me and keep you informed...
OK, I've just submitted a PR.
As you will see, it's far from being "groovy"... I only know Java. And I know it's not perfect... I think the collection of such information should be done earlier on.
Well, it Works For Me(tm)...
OK well, as far as I'm concerned this issue can be closed.
When do you think a first version will be published? I'd like to code an example plugin using your plugin and sonar-sslr-grappa
There are a few other small bits that need doing, no blockers to publishing an initial version. I'll try and get this published in the next day or two.
An initial version has been released https://plugins.gradle.org/plugin/com.iadams.sonar-packaging
@fge Have you had a chance to use the initial version?
Yes, I have been using it for several weeks straight for my language plugin without a hitch :)
I mentioned in on dev@sonar, didn't you notice?
Didn't see anything after i posted on the release, i just wanted to add a little bit to the readme of examples of it being used.
Argh...
Well, I use it in a project which is commercial :(
What I'll do is convert https://github.com/litesolutions/sonar-dummylanguage to use your plugin and tell you when it's done.
Sorry for that :/
Contents of the generated plugin by maven and gradle:
What Sonar tells me when I start it up (5.1) is:
All other components compile etc correctly.
The build.gradle in the packaging directory looks like this:
Note that
checks
defines theversion
, which is defined in the mainbuild.gradle
as being 0.1.0-SNAPSHOT (by the way, why do I have to redefine it insubprojects
?)More details on demand.