diff --git a/build.gradle b/build.gradle index 665805b..6631cdd 100644 --- a/build.gradle +++ b/build.gradle @@ -103,13 +103,30 @@ task javadocJar(type: Jar) { task sourcesJar(type: Jar) { classifier = 'sources' from sourceSets.main.allSource - manifest = osgiManifest { - classesDir = project.sourceSets.main.output.classesDir - classpath = project.sourceSets.main.runtimeClasspath - instruction "Bundle-ManifestVersion", "2" - instruction "Bundle-SymbolicName", "${project.group}.${project.name}.source" - instruction "Bundle-Version", project.version.toString() - instruction "Eclipse-SourceBundle", "${project.group}.${project.name};version=\"${project.version}\";roots:=\".\"" + manifest { // manifest is NOT of type OsgiManifest + // 15knots: these 2 seem to put in Im/Export-Package which is not needed or could harm.. + //classesDir = project.sourceSets.main.output.classesDir + //classpath = project.sourceSets.main.runtimeClasspath + + // 15knots: There is a problem with expansion of project.version: In the binary jar, it expands to + // 0.16.1.dev_1_uncommitted_317bbfa in the Bundle-Version header, in the source jar, it expands to + // 0.16.1-dev.1.uncommitted+317bbfa (note the minus instead of the dot). As a result, Eclipse will + // not find and open the source bundle. (Eclipse uses major.minor.patchlevel.qualifier as version numbers, + // but gradle seem to use major.minor.patchlevel-something). + // + // Sorry, I do not know enough about gradle to jam in the proper version from the binary jar manifest + // into the source bundle manifest. + // As a maven user, I use http://www.mojohaus.org/build-helper-maven-plugin/parse-version-mojo.html + // to convert maven project versions to osgi versions. I do not use the bnd to to generate OSGI headers (bnd + // is the base of gradle`s osgi plugin). Ask for my maven example, if it helps! + attributes( + "Eclipse-SourceBundle": "${project.group}.${project.name};version=\"${project.version}\";roots:=\".\"", + // 15knots: I removed ${project.group} to match binary jar, which just has 'sshj' here.. + "Bundle-Name": "${project.name} Source", + "Bundle-ManifestVersion": "2", + "Bundle-SymbolicName": "${project.group}.${project.name}.source", + "Bundle-Version": project.version.toString() + ) } }