VM-Operator/buildSrc/src/org.jdrupes.vmoperator.java-common-conventions.gradle

124 lines
3.1 KiB
Groovy
Raw Normal View History

2023-05-23 21:38:32 +02:00
/*
* This file was generated by the Gradle 'init' task.
*
* This project uses @Incubating APIs which are subject to change.
*/
plugins {
// Apply the java Plugin to add support for Java.
id 'java'
2023-06-05 10:50:00 +02:00
// Git based versioning
id 'pl.allegro.tech.build.axion-release'
2023-05-23 21:38:32 +02:00
// Apply eclipse plugin
id 'eclipse'
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
mavenLocal()
}
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(17)
}
}
2023-06-05 10:50:00 +02:00
scmVersion {
versionIncrementer 'incrementMinor'
tag {
def shortened = project.name.startsWith(project.group + ".") ?
project.name.substring(project.group.length() + 1) : project.name
prefix = shortened.replace('.', '-') + "-"
}
}
version = scmVersion.version
ext.isSnapshot = version.endsWith('-SNAPSHOT')
2023-05-23 21:38:32 +02:00
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')
}
}
}