springboot maven项目转gradle的完整方法
Posted luchangjiang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot maven项目转gradle的完整方法相关的知识,希望对你有一定的参考价值。
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的完整方法的主要内容,如果未能解决你的问题,请参考以下文章