141 lines
4.3 KiB
Groovy
141 lines
4.3 KiB
Groovy
import org.gradle.plugins.ide.eclipse.model.AccessRule
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
plugins {
|
|
id 'java'
|
|
id 'eclipse'
|
|
id 'com.github.ben-manes.versions' version "0.39.0" // check for dependency updates run: gradlew dependenyUpdates
|
|
}
|
|
|
|
|
|
ext {
|
|
|
|
javaVersion=16
|
|
|
|
version_log4j2= '2.15.0' // keep in sync with spring-boot-starter-log4j2
|
|
version_spring = '2.6.1'
|
|
version_junit = '5.8.2'
|
|
version_junit_platform = '1.8.2'
|
|
version_nodejs = '16.14.2' // keep in sync with npm
|
|
version_npm = '8.5.0' // keep in sync with nodejs
|
|
|
|
lib_antlr = "org.antlr:antlr4:4.9.3"
|
|
|
|
lib_commons_collections4 = 'org.apache.commons:commons-collections4:4.4'
|
|
lib_commons_csv= 'org.apache.commons:commons-csv:1.9.0'
|
|
lib_commons_lang3 = 'org.apache.commons:commons-lang3:3.12.0'
|
|
lib_jackson_databind = 'com.fasterxml.jackson.core:jackson-databind:2.12.4'
|
|
|
|
lib_log4j2_core = "org.apache.logging.log4j:log4j-core:${version_log4j2}"
|
|
lib_log4j2_slf4j_impl = "org.apache.logging.log4j:log4j-slf4j-impl:${version_log4j2}"
|
|
|
|
lib_primitive_collections='org.lucares:primitiveCollections:0.3'
|
|
|
|
lib_spring_boot_log4j2="org.springframework.boot:spring-boot-starter-log4j2:${version_spring}"
|
|
lib_spring_boot_test="org.springframework.boot:spring-boot-starter-test:${version_spring}"
|
|
lib_spring_boot_web="org.springframework.boot:spring-boot-starter-web:${version_spring}"
|
|
|
|
eclipseAccessRestrictions = [
|
|
'org.eclipse.jdt.launching.JRE_CONTAINER': [
|
|
new AccessRule('nonaccessible', 'com/sun/**'),
|
|
new AccessRule('nonaccessible', 'java/awt/List'),
|
|
new AccessRule('nonaccessible', 'sun/**'),
|
|
],
|
|
'assertj-core': [new AccessRule('nonaccessible', 'org/assertj/core/internal/**'), new AccessRule('nonaccessible', 'org/assertj/core/util/Arrays')
|
|
]]
|
|
}
|
|
|
|
/*
|
|
* The shared configuration for all sub-projects:
|
|
*/
|
|
subprojects {
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'eclipse'
|
|
|
|
compileJava.options.encoding = 'UTF-8'
|
|
|
|
// java compatibility version
|
|
sourceCompatibility = javaVersion
|
|
|
|
java {
|
|
// Beginning with Gradle 7.0 some libraries are put on the module path, but Eclipse can't handle that.
|
|
modularity.inferModulePath.set(false)
|
|
}
|
|
|
|
configurations {
|
|
tests
|
|
}
|
|
|
|
// the repositories for external dependencies
|
|
repositories {
|
|
mavenLocal()
|
|
maven {
|
|
url 'https://repo.lucares.de/'
|
|
content { includeGroup "org.lucares" }
|
|
}
|
|
mavenCentral(content: { excludeGroup "org.lucares" })
|
|
}
|
|
|
|
test{
|
|
useJUnitPlatform {
|
|
includeEngines 'junit-jupiter'
|
|
excludeEngines 'junit-vintage'
|
|
}
|
|
}
|
|
|
|
// dependencies that all sub-projects have
|
|
dependencies {
|
|
testImplementation("org.junit.jupiter:junit-jupiter-engine:${version_junit}")
|
|
testImplementation "org.junit.jupiter:junit-jupiter-params:${version_junit}" // for @ParameterizedTest
|
|
testImplementation "org.junit.platform:junit-platform-launcher:${version_junit_platform}" // needed by eclipse
|
|
}
|
|
|
|
task eclipseSettings(type: Copy) {
|
|
from ("${rootProject.projectDir}/eclipse/") {
|
|
include '**/*.prefs'
|
|
filter(ReplaceTokens, tokens: [javaVersion: "${rootProject.javaVersion}".toString()])
|
|
}
|
|
into "${project.projectDir}/.settings/"
|
|
}
|
|
tasks.eclipseJdt.dependsOn eclipseSettings
|
|
tasks.cleanEclipseJdt.dependsOn cleanEclipseSettings
|
|
|
|
eclipse {
|
|
classpath {
|
|
file {
|
|
whenMerged {
|
|
eclipseAccessRestrictions.each{ path, restrictions ->
|
|
def container = entries.find { it.path.contains path }
|
|
if (container != null) {
|
|
container.accessRules.addAll(restrictions)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
project {
|
|
//if you don't want any node_modules folder to appear in Eclipse, you can filter it out:
|
|
resourceFilter {
|
|
appliesTo = 'FOLDERS'
|
|
type = 'EXCLUDE_ALL'
|
|
matcher {
|
|
id = 'org.eclipse.ui.ide.multiFilter'
|
|
arguments = '1.0-name-matches-false-false-node_modules'
|
|
}
|
|
}
|
|
}
|
|
jdt {
|
|
file {
|
|
withProperties { properties ->
|
|
//you can tinker with the Properties here
|
|
properties.put("XXXXXXX", "YYYYYYYY")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
wrapper {
|
|
gradleVersion = '7.4'
|
|
}
|