将maven 切换成 gradle
./gradlew init --type=pom
//选择groovy
//build.gradle
plugins {
id 'java'
id 'org.springframework.boot' version '2.5.5'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}
apply plugin: "maven-publish"
group 'com.example'
version '1.0-SNAPSHOT'
repositories {
mavenLocal()
maven {
allowInsecureProtocol = true
url = uri('https://maven.aliyun.com/nexus/content/groups/public/')
}
maven {
allowInsecureProtocol = true
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
implementation 'com.google.code.bean-matchers:bean-matchers:0.13'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
// testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
//该依赖自己制作的依赖,因此我将其复制到了根路径下的libs中
// implementation 'liyuan.user:base-jwt-security:1.0-SNAPSHOT'
implementation fileTree(dir: "libs",includes: ["*.jar"])
implementation 'mysql:mysql-connector-java:8.0.16'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.alibaba:fastjson:1.2.73'
implementation 'org.springframework.boot:spring-boot-starter-security'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
implementation "org.springframework.boot:spring-boot-starter-amqp"
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'com.pig4cloud.plugin:knife4j-spring-ui:3.0.2'
implementation 'io.swagger:swagger-annotations:1.5.20'
}
test {
useJUnitPlatform()
}
//
ext {
registryUrl = "1.116.38.204"
}
apply plugin: 'idea'
//docker {
// url = "http://1.116.38.204:2375"
// url.set("tcp:1.116.38.204:2375")
//
SpringBootApplication{
baseImage = "java:8"
maintainer="liyuan"
ports = [8080]
images = ["${registryUrl}/gdufs-lib/${rootProject.name}:${version}"]
jvmArgs=["-Dspring.profiles.active=pro"]
}
//}
//
tasks.withType(JavaCompile) {
options.encoding = "utf-8"
}
// build.gradle.kts
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
java
`maven-publish`
}
val localRepo = "file://" + File("E:\\m2").absoluteFile
repositories {
maven(localRepo)
maven(url = "https://maven.aliyun.com/repository/jcenter")
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE")
implementation("org.springframework.boot:spring-boot-starter-security:2.3.2.RELEASE")
implementation("org.springframework.boot:spring-boot-devtools:2.3.2.RELEASE")
implementation("org.springframework.boot:spring-boot-configuration-processor:2.3.2.RELEASE")
implementation("com.alibaba:fastjson:1.2.73")
implementation("org.springframework.security:spring-security-jwt:1.0.11.RELEASE")
testImplementation("junit:junit:4.13")
}
group = "liyuan.jwt"
version = "1.0-SNAPSHOT"
description = "jwt-security"
java.sourceCompatibility = JavaVersion.VERSION_1_8
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}
tasks.withType<JavaCompile>() {
options.encoding = "utf-8"
}