Переезд на новый градл

This commit is contained in:
2025-02-25 17:43:31 +03:00
5 changed files with 79 additions and 49 deletions

View File

@ -1,22 +1,13 @@
buildscript {
repositories {
maven { url 'http://nexus.red-soft.biz/repository/public' }
mavenLocal()
}
dependencies {
classpath 'biz.redsoft.gradle.ncore:gradle-ncore:1.2.+'
classpath 'nu.studer:gradle-credentials-plugin:1.0.4'
}
plugins {
id 'nu.studer.credentials' version('1.0.4')
id 'idea'
id 'eclipse'
id 'application'
id 'java-library'
id 'war'
id 'gradle-ncore' version('3.0.65')
}
group = 'biz.redsoft.sample'
apply plugin: 'nu.studer.credentials'
apply plugin: 'idea'
apply plugin: 'application'
apply plugin: 'war'
apply plugin: 'ncore'
apply from: "dependencies.gradle"
targetCompatibility = 1.8
@ -27,28 +18,27 @@ ncore {
}
repositories {
mavenLocal()
maven {
url 'http://nexus.red-soft.biz/repository/public'
url 'https://ncore-repo.red-soft.ru/repository/public'
if (project.credentials.user != null && project.credentials.password != null) {
credentials {
username project.credentials.user
password project.credentials.password
}
credentials {
username project.credentials.user
password project.credentials.password
}
}
}
}
dependencies {
testImplementation 'junit:junit:4.13.1'
provided 'javax.servlet:javax.servlet-api:3.1.0'
implementation 'javax.servlet:javax.servlet-api:3.1.0'
testCompileClasspath 'org.junit.jupiter:junit-jupiter:5.8.2'
testImplementation 'org.apache.tomcat.embed:tomcat-embed-core:9.0.76'
testImplementation 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.76'
testCompile 'org.junit.jupiter:junit-jupiter:5.8.2'
runtimeClasspath files(ncoreGenerateControlDataJar)
runtimeClasspath files(genJar)
}
// writing build process to a log file
// --------------------- BUILD LOG SETTINGS ----------------------
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss')
@ -56,16 +46,20 @@ def buildLogDir = "${rootDir}/logs"
mkdir("${buildLogDir}")
def buildLog = new File("${buildLogDir}/${tstamp}_buildLog.log")
import org.gradle.internal.logging.*
import org.gradle.internal.logging.LoggingOutputInternal
import java.util.regex.Matcher
System.setProperty('org.gradle.color.error', 'RED')
gradle.services.get(LoggingOutputInternal).addStandardOutputListener (new StandardOutputListener () {
gradle.services.get(LoggingOutputInternal).addStandardOutputListener(new StandardOutputListener() {
void onOutput(CharSequence output) {
buildLog << output
}
})
gradle.services.get(LoggingOutputInternal).addStandardErrorListener (new StandardOutputListener () {
gradle.services.get(LoggingOutputInternal).addStandardErrorListener(new StandardOutputListener() {
void onOutput(CharSequence output) {
buildLog << output
}
@ -88,15 +82,38 @@ task copyDist(type: Copy) {
into "$releaseDir/$project.name/$version"
}
def versionPropertiesFilePath = sourceSets.main.resources.srcDirs[0].toString() + File.separator + "META-INF/ncore-product/${project.group}/version.properties"
release {
tagPrefix = 'v'
commitNewVersion.enabled(true)
failOnCommitNeeded = false
failOnPublishNeeded = true
failOnSnapshotDependencies = true
failOnUnversionedFiles = false
failOnUpdateNeeded = false
revertOnFail = true
preCommitText = ''
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
tagTemplate = "${project.name}/v${version}"
versionPropertyFile = versionPropertiesFilePath
versionProperties = []
snapshotSuffix = '-SNAPSHOT'
buildTasks = ['buildRelease', 'commitNewVersion']
ignoredSnapshotDependencies = []
versionPatterns = [
/(\d+)(\.)(\d+)(\.)(\d+)([^\d]*\u0024)/: { Matcher m, Project p ->
project.getVersion().newVersion().toString()
}
]
pushReleaseVersionBranch = null
}
task buildRelease(type: GradleBuild) {
tasks = ['clean', 'writeVersion', 'nbackup', 'build', 'copyDist', 'publish']
}
idea { module.scopes.PROVIDED.plus += [configurations.provided] }
jar{
manifest{
@ -107,6 +124,13 @@ jar{
}
}
startScripts{
startScripts {
project.startScripts.defaultJvmOpts = ['-Dlogback.configurationFile=./config/logback.xml']
}
distTar {
duplicatesStrategy = DuplicatesStrategy.WARN
}
distZip {
duplicatesStrategy = DuplicatesStrategy.WARN
}

View File

@ -1,13 +1,13 @@
buildscript {
repositories {
maven {
url 'https://nexus.red-soft.ru/repository/ncore-public'
}
mavenLocal()
}
dependencies {
classpath 'nu.studer:gradle-credentials-plugin:1.0.4'
}
}
apply plugin: 'nu.studer.credentials'
buildscript {
repositories {
maven {
url 'https://nexus.red-soft.ru/repository/ncore-public'
}
mavenLocal()
}
dependencies {
classpath 'nu.studer:gradle-credentials-plugin:1.0.7'
}
}
apply plugin: 'nu.studer.credentials'

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip

View File

@ -1 +1,7 @@
pluginManagement{
repositories {
maven { url 'https://ncore-repo.red-soft.ru/repository/public' }
}
}
rootProject.name = 'sample'

View File

@ -1,4 +1,4 @@
{
"dependencies": [],
"register": {}
}
"dependencies" : [ ],
"register" : { }
}