1 Star 0 Fork 66

独行侠/nice-blog-sys

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.gradle 9.35 KB
一键复制 编辑 原始数据 按行查看 历史
//插件开发场景中,目标插件需要依赖的包下载中央仓库
buildscript {
repositories {
//读取%M2_HOME%环境变量下面的/conf/setting.xml中的本地maven仓库
mavenLocal()
maven { url 'https://mirrors.huaweicloud.com/repository/maven/' }
maven { url "https://maven.aliyun.com/repository/public" }
gradlePluginPortal()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.2.1.RELEASE"
classpath "io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE"
classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0"
}
}
allprojects {
apply from: this.file('common.gradle')
group rootProject.ext.group
version rootProject.ext.version
}
subprojects {
//java增强插件
apply plugin: 'java-library'
//证书插件
apply plugin: "com.github.hierynomus.license"
//这是默认源码目录配置,这里强调一下,免得idea有时候无法识别源码目录
sourceSets {
main {
java {
srcDirs = ['src/main/java']
}
resources {
srcDirs = ['src/main/resources']
}
}
test {
java {
srcDirs = ['src/test/java']
}
resources {
srcDirs = ['src/test/resources']
}
}
}
license {
encoding = "UTF-8"
header = rootProject.file("FILE_HEADER.txt")
includes(["**/*.java", "**/*.kt"])
exclude "**/test/**/*.java"
exclude "**/*Test.java"
ignoreFailures = false
}
//依赖管理插件
apply plugin: "io.spring.dependency-management"
dependencyManagement {
dependencies {
//spring framework
dependency "org.springframework.boot:spring-boot:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-autoconfigure:${springBootVersion}"
dependency("org.springframework.boot:spring-boot-starter-test:${springBootVersion}") {
exclude 'org.junit.vintage:junit-vintage-engine'
}
dependency "org.springframework.boot:spring-boot-starter-thymeleaf:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-starter-data-mongodb:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-starter-cache:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-starter-aop:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-legacy:1.0.2.RELEASE"//让古老的Servlet起作用
dependency "org.freemarker:freemarker:${freemarkerVersion}"
//shiro
dependency "org.apache.shiro:shiro-spring:${shiroVersion}"
dependency "org.apache.shiro:shiro-core:${shiroVersion}"
dependency "org.apache.shiro:shiro-ehcache:${shiroVersion}"
//cache
dependency "org.springframework.boot:spring-boot-starter-data-redis:${springBootVersion}"
dependency "net.sf.ehcache:ehcache:${ehcacheVersion}"
//mybatis
dependency "org.mybatis:mybatis:${mybatisVersion}"
dependency "org.mybatis.spring.boot:mybatis-spring-boot-starter:${mybatisSpringBootStarterVersion}"
dependency "com.baomidou:mybatis-plus-boot-starter:${mybatisPlusVersion}"
//common helper
dependency "javax.servlet:javax.servlet-api:${servletApiVersion}"
dependency "org.apache.velocity:velocity:${velocityVersion}"
dependency "org.apache.httpcomponents:httpmime:${httpcomponentsVersion}"
dependency "org.apache.httpcomponents:httpclient:${httpcomponentsVersion}"
dependency "org.apache.commons:commons-email:${commonsEmailVersion}"
dependency "com.qiniu:qiniu-java-sdk:${qiniuJavaSdkVersion}"
dependency "com.squareup.okhttp3:okhttp:${okhttp3Version}"
dependency "com.google.code.gson:gson:${gsonVersion}"
dependency "com.qiniu:happy-dns-java:${happyDnsJavaVersion}"
dependency "commons-io:commons-io:${commonsIoVersion}"
dependency "com.alibaba:druid:${druidVersion}"
dependency "com.alibaba:fastjson:${fastjsonVersion}"
dependency "cn.hutool:hutool-all:${hutoolAllVersion}"
dependency "org.codehaus.groovy:groovy-json:${groovyJsonVersion}"
//swagger
dependency "io.springfox:springfox-swagger2:${swaggerVersion}"
dependency "io.springfox:springfox-swagger-ui:${swaggerVersion}"
//compileOnly
dependency "org.projectlombok:lombok:${lombokVersion}"
dependency "org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}"
dependency "org.springframework.boot:spring-boot-devtools:${springBootVersion}"
//runtimeOnly
//dependency "com.oracle.ojdbc:ojdbc8:${ojdbc8Version}"
//dependency 'mysql:mysql-connector-java:8.0.18'
dependency "mysql:mysql-connector-java:${mysqlConnectorJavaVersion}"
dependency "ch.qos.logback:logback-classic:${logbackVersion}"
//test
dependency "org.assertj:assertj-core:${assertjCoreVersion}"
dependency "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
dependency "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
}
}
apply plugin: 'maven-publish'
//打包源码
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing {
publications {
maven(MavenPublication) {
//指定group/artifact/version信息,可以不填。默认使用项目group/name/version作为groupId/artifactId/version
groupId project.group
artifactId project.name
version project.version
//如果是war包填写components.web,如果是jar包填写components.java
from components.java
//配置上传源码
artifact sourceJar {
classifier "sources"
}
}
}
repositories {
maven {
def userName = System.getProperty("GRADLE_USER_NAME")
def passWord = System.getProperty("GRADLE_USER_PASSWORD")
def releasesRepoUrl = "https://devrepo.devcloud.cn-north-4.huaweicloud.com/07/nexus/content/repositories/06fc39fb36800ff20fc8c00fb9b55ae0_1_0/"
def snapshotsRepoUrl = "https://devrepo.devcloud.cn-north-4.huaweicloud.com/07/nexus/content/repositories/06fc39fb36800ff20fc8c00fb9b55ae0_2_0/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username userName
password passWord
}
}
}
}
//jdk版本
sourceCompatibility = "${javaVersion}"
targetCompatibility = "${javaVersion}"
//编码配置
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.deprecation = true
options.compilerArgs += ["-parameters"]
}
//中央仓库配置
repositories {
//本地仓库->国内大厂镜像->官网提供仓库
mavenLocal()
maven { url 'https://mirrors.huaweicloud.com/repository/maven/' }
maven { url "https://maven.aliyun.com/repository/public" }
jcenter()
}
jar {
/**
* 默认内容:
* Manifest-Version: 1.0
* Start-Class: cn.kiwipeach.blog.BlogWebApplication
* Spring-Boot-Classes: BOOT-INF/classes/
* Spring-Boot-Lib: BOOT-INF/lib/
* Spring-Boot-Version: 2.2.1.RELEASE
* Main-Class: org.springframework.boot.loader.JarLauncher
*/
afterEvaluate {
manifest {
attributes 'Implementation-Version': rootProject.ext.version
attributes 'Implementation-Title': rootProject.ext.description
attributes 'Built-Gradle': gradle.gradleVersion
attributes 'Bundle-DocURL': 'https://gitee.com/kiwipeach/nice-blog-sys'
attributes 'Build-OS': System.getProperty("os.name")
attributes 'Built-By': System.getProperty("user.name")
attributes 'Build-Jdk': System.getProperty("java.version")
attributes 'Build-Timestamp': new Date().format('yyyy-MM-dd HH:mm:ss')
}
}
}
}
//动态插件配置
//project('blog-sys-boot') { Project project ->
// dependencies {
// implementation (rootProject.ext.dependencies.hutoolAll)
// }
//}
def printProjectDir = {
println("*****************************")
println("Root Dir:${getRootDir()}")
println("Current Project:${getProjectDir()}")
println("Current Project Build Out Dir:${getBuildDir()}")
println("*****************************")
}
printProjectDir.call()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/chivalrous_man/nice-blog-sys.git
git@gitee.com:chivalrous_man/nice-blog-sys.git
chivalrous_man
nice-blog-sys
nice-blog-sys
master

搜索帮助