码迷,mamicode.com
首页 > 编程语言 > 详细

springboot maven项目转gradle的完整方法

时间:2019-08-17 20:04:20      阅读:408      评论:0      收藏:0      [点我收藏+]

标签:project   ESS   png   工具   under   com   color   postgres   agg   

1、maven转gradle的方法:在项目根目录下,使用命令行工具,输入如下内容:

gradle init --type.pom

 2、springboot项目的 build.gradle内容示例如下(注意部分内容需要自己添加进去):

/*
 * 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、运行,找到项目build\libs对应的jar包,用java -jar XX.jar执行即可:

 

  

 

springboot maven项目转gradle的完整方法

标签:project   ESS   png   工具   under   com   color   postgres   agg   

原文地址:https://www.cnblogs.com/luchangjiang/p/11369710.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!