Ver5

Global設定

設定環境變數

GRADLE_USER_HOME=xxx/xxx/xxx ,預設是家目錄下的.gradle

Property

GRADLE_USER_HOME\gradle.properties

org.gradle.java.home=D:\\openjdk-1.8.0.191
org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
mavenUsername=account
mavenPasswoer=123123123

初始script

GRADLE_USER_HOME\init.gradle

settingsEvaluated { settings ->
    settings.pluginManagement {
       
        repositories {
        	maven {
        		url 'http://xxx.xxx.xxx.xxx:8080/artifactory/libs-release'        		
    		} 
        }
    }
}
allprojects {
    repositories {
		maven {
        	url 'http://xxx.xxx.xxx.xxx:8080/artifactory/libs-release'
        	authentication {
            	basic(BasicAuthentication)
        	}
        	credentials {
            	username = mavenUsername
            	password = mavenPasswoer
        	}
    	}  
    }
}

Project 設定

settings.gradle

/*pluginManagement {
    repositories {
        maven {
            url 'http://xxx.xxx.xxx.xxx:8080/artifactory/libs-release'
        }
    }
}*/
rootProject.name = 'XXX'

build.gradle

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.1.2.RELEASE'
    id 'io.spring.dependency-management' version '1.0.6.RELEASE'
    id 'net.ltgt.apt' version '0.19'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '0.0.1'

bootJar {
	mainClassName = 'XXXX.APP'
}


configurations {
	all {
		exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
	}
}

dependencies {
    compileOnly 'org.projectlombok:lombok:1.18.4'	
	annotationProcessor 'org.projectlombok:lombok:1.18.4'
    
	implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-log4j2'
    
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}