springboot maven project transfer complete method of gradle

1. A method of gradle maven transfer: the project root directory, use command-line tools, enter the following:

gradle init --type.pom

 2, build.gradle example springboot content items are as follows (note that part needs to be added into their own):

/*
 * This file was generated by the Gradle 'init' task.
 */
buildscript {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
repositories {
    mavenLocal()
    maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter:2.1.6.RELEASE'
    compile 'org.springframework.boot:spring-boot-starter-web:2.1.6.RELEASE'
    compile 'org.springframework.boot:spring-boot-starter-undertow:2.1.6.RELEASE'
    compile 'org.postgresql:postgresql:42.2.5'
    compile 'com.baomidou:mybatis-plus-boot-starter:3.1.2'
    compile 'com.alibaba:druid-spring-boot-starter:1.1.16'
    compile 'org.springframework.security:spring-security-core:5.1.5.RELEASE'
    compile 'org.springframework:spring-tx:5.1.8.RELEASE'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'org.apache.commons:commons-collections4:4.1'
    compile 'joda-time:joda-time:2.10.3'
    compile 'com.spring4all:swagger-spring-boot-starter:1.8.0.RELEASE'
    annotationProcessor 'org.projectlombok:lombok:1.18.8'
    compileOnly 'org.projectlombok:lombok:1.18.8'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.8'
    testCompileOnly 'org.projectlombok:lombok:1.18.8'
    testCompile 'org.springframework.boot:spring-boot-starter-test:2.1.6.RELEASE'
}

group = 'com.river'
version = '0.0.1-SNAPSHOT'
description = 'PostgrePlus'
sourceCompatibility = '1.8'

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

 3、打包:tasks->build->bootJar

   4, Run, locate the project build \ libs corresponding jar package, you can execute with java -jar XX.jar:

 

  

 

Guess you like

Origin www.cnblogs.com/luchangjiang/p/11369710.html