/* * This file was generated by the Gradle 'init' task. * * This project uses @Incubating APIs which are subject to change. */ plugins { // Apply the common versioning conventions. // Put this at the start, because accessing project.version before // this is applied makes things fail. id 'org.jdrupes.vmoperator.versioning-conventions' // Apply the java Plugin to add support for Java. id 'java' // Apply eclipse plugin id 'eclipse' // Access to git information id 'org.ajoberstar.grgit' } repositories { // Use Maven Central for resolving dependencies. mavenCentral() } dependencies { constraints { // Define dependency versions as constraints // implementation 'org.apache.commons:commons-text:1.9' } } // Configure sensible layout sourceSets { main { java { srcDirs = ['src'] } resources { srcDirs = ['resources'] } } test { java { srcDirs = ['test'] } resources { srcDirs = ['test-resources'] } } } java { toolchain { languageVersion = JavaLanguageVersion.of(21) } } jar { manifest { def matchExpr = [ project.tagName + "*" ] inputs.property("gitDescriptor", { grgit.describe(always: true, match: matchExpr) }) // Set Git revision information in the manifests of built bundles def gitDesc = grgit.describe(always: true, match: matchExpr) attributes([ "Implementation-Title": project.name, "Implementation-Version": "$project.version (built from ${gitDesc})", "Implementation-Vendor": grgit.repository.jgit.repository.config.getString("user", null, "name") + " (" + grgit.repository.jgit.repository.config.getString("user", null, "email") + ")", "Git-Descriptor": gitDesc, "Git-SHA": grgit.head().id, ]) } } eclipse { project { file { // closure executed after .project content is loaded from existing file // and before gradle build information is merged beforeMerged { project -> project.natures.clear() project.buildCommands.clear() } project.natures += 'org.eclipse.buildship.core.gradleprojectnature' project.buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder' if (plugins.hasPlugin('java')) { project.buildCommand 'org.eclipse.jdt.core.javabuilder' project.natures += 'net.sf.eclipsecs.core.CheckstyleNature' project.buildCommand 'net.sf.eclipsecs.core.CheckstyleBuilder' project.natures += 'ch.acanda.eclipse.pmd.builder.PMDNature' project.buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder' } if (plugins.hasPlugin('biz.aQute.bnd')) { project.natures += 'bndtools.core.bndnature' project.buildCommand 'bndtools.core.bndbuilder' } } } classpath { downloadJavadoc = true downloadSources = true } jdt { file { withProperties { properties -> def formatterPrefs = new Properties() rootProject.file("gradle/org.eclipse.jdt.core.formatter.prefs") .withInputStream { formatterPrefs.load(it) } properties.putAll(formatterPrefs) } } } } testing { suites { // Configure the built-in test suite test { // Use JUnit Jupiter test framework useJUnitJupiter('5.9.1') } } }