plugins {
java
// id("io.cometa.allure") version "2.34.0"
}
// Настройки репозитория
val tokenName: String by project
val tokenPassword: String by project
val nexusPublicRepository: String by project
val nexusInternalRepository: String by project
// Проект обзываем
group = "ru.sber.qa.automation"
version = "0.0.1"
java {
toolchain { languageVersion.set(JavaLanguageVersion.of(21)) }
}
repositories {
// Репозиторий публичный
maven {
url = uri(nexusPublicRepository)
isAllowInsecureProtocol = true
credentials {
username = tokenName
password = tokenPassword
}
}
// Репозиторий внутренний
maven {
url = uri(nexusInternalRepository)
isAllowInsecureProtocol = true
credentials {
username = tokenName
password = tokenPassword
}
}
mavenCentral()
}
dependencies {
testImplementation(group = "org.junit.platform", name = "junit-platform-suite", version = "1.10.3")
testImplementation("org.testcontainers:kafka:1.20.4")
testImplementation("org.testcontainers:junit-jupiter:1.20.6")
testImplementation("io.qameta.allure:allure-junit5:2.34.0")
}
tasks {
// Для компиляции ставим кодировку UTF-8
withType<JavaCompile> {
options.encoding = "UTF-8"
}
}
tasks.withType<Test> {
// Считываем параметр -Pparallel (по умолчанию false)
val isParallel = providers.gradleProperty("parallel")
.getOrElse("false")
.toBoolean()
if (isParallel) {
// Уровень Gradle: запускаем в разных JVM процессах
// Рекомендуется: 50% от доступных ядер CPU
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
// Уровень JUnit: параллелизм внутри одной JVM
systemProperties(
"junit.jupiter.execution.parallel.enabled" to "true",
"junit.jupiter.execution.parallel.mode.default" to "concurrent",
"junit.jupiter.execution.parallel.mode.classes.default" to "concurrent"
)
}
}