-1

Alright i want to rename the bundles generated by my build to specify the version in its name, but everything i do seems to be ignored, and the bundle ends up with the projects folder name everytime.

build.gradle file

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    // https://mvnrepository.com/artifact/org.osgi/org.osgi.core
    compile group: 'org.osgi', name: 'org.osgi.core', version: '6.0.0'
}

task copyJar(type: Copy) {
    from('generated')
    include('*.jar')
    into("$rootDir/build/lib/bundles")
}

build.finalizedBy(copyJar)

gradle.properties

bundle_name=helloworld
bundle_version=5.1.2

from what i understand, the jar task uses the baseName and version properties, along with other properties to name the jar if nothing has been specified, so i tried in the build.gradle file but it doesnt work, i keep getting a jar file with the name of the projects folder

jar.baseName = "$bundle_name"
jar.version = "$bundle_version"

also im using the bnd workspace plugin, and i think its overriding the way the jar task works but im not sure

here's the parent project build.gradle

    //Applying the Gradle BND Plugin for Workspace Builds
    //https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/README.md
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:${bnd_version}"
    }
}
apply plugin: 'biz.aQute.bnd.workspace'
apply plugin: 'java'

    // Repositorios, aguante Maven Central.
/*
repositories {
    mavenCentral()
}
*/

clean {
    delete ("$rootDir/build/libs/bundles")
}

thank you for reading

1 Answers1

1

If you are using the Bnd workspace plugin, then you must control Bnd via the project’s bnd.bnd file. See the -outputmask instruction to control the output name.

BJ Hargrave
  • 9,324
  • 1
  • 19
  • 27
  • works like a charm, now i get it. thank you very much sir – Federico von Wernich Nov 27 '17 at 04:18
  • may i ask a follow up question? now it works and i get the jar file with the desired name, but gradle now generates two jar files, one with the name i set up in the bnd.bnd file, and other jar with the previus generic name, where can i disable the creation of the later jar file? – Federico von Wernich Nov 27 '17 at 05:03