#Idea中Maven工程如何转换为Gradle工程
-
打开Maven项目
-
修改settings中Maven的本地仓库
![在这里插入图片描述](https://img-blog.csdnimg.cn/27007a03d5df423cb32ffbf80a89eabb.png#pic_center)
-
修改settings中项目的编码格式
![在这里插入图片描述](https://img-blog.csdnimg.cn/bf3e8138b5534e099c5b3ee63004a530.png#pic_center)
4.刷新Maven的相应插件
![在这里插入图片描述](https://img-blog.csdnimg.cn/e373504ea01e4ad8b619a806ba3b6951.png#pic_center)
5.在Idea中TerMinal输入“gradle init --type pom”,根据提示设置参数
![在这里插入图片描述](https://img-blog.csdnimg.cn/fb32550710ce47fb9983f1af9783eb2e.png#pic_center)
根据提示输入"1"选择Groovy
![在这里插入图片描述](https://img-blog.csdnimg.cn/0f790cf738c144d4a16d823e1cabb73d.png#pic_center)
格局提示输入"no" 选择默认
![在这里插入图片描述](https://img-blog.csdnimg.cn/8a64af6afb7745ad889f3fd9fef1f5b5.png#pic_center)
5、刷新项目–项目已转换成功
![在这里插入图片描述](https://img-blog.csdnimg.cn/ff212274fd854bd98c0e9d689a436c2c.png#pic_center)
6、点击右下角提示,此时会报错,修改settings配置Gradle本地仓库等
![在这里插入图片描述](https://img-blog.csdnimg.cn/236314493a0d47d6b8f7165d600abc05.png)
7、修改settings配置Gradle本地仓库等
![在这里插入图片描述](https://img-blog.csdnimg.cn/5f7fdef0757a47f6a26b5c56210f0f56.png#pic_center)
7、配置项目中的build.gradle文件
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
/**删除掉
id 'java'
id 'maven-publish'
**/
id 'war' //添加id 'war'
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
implementation 'org.springframework:spring-context:5.3.1'
implementation 'org.springframework:spring-beans:5.3.1'
implementation 'org.springframework:spring-web:5.3.1'
implementation 'org.springframework:spring-webmvc:5.3.1'
implementation 'org.springframework:spring-jdbc:5.3.1'
implementation 'org.springframework:spring-aspects:5.3.1'
implementation 'org.springframework:spring-test:5.3.1'
implementation 'org.mybatis:mybatis:3.5.7'
implementation 'org.mybatis:mybatis-spring:2.0.6'
implementation 'com.alibaba:druid:1.0.9'
implementation 'mysql:mysql-connector-java:8.0.16'
implementation 'log4j:log4j:1.2.17'
implementation 'com.github.pagehelper:pagehelper:5.2.0'
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.1'
implementation 'commons-fileupload:commons-fileupload:1.3.1'
implementation 'org.thymeleaf:thymeleaf-spring5:3.0.12.RELEASE'
testImplementation 'junit:junit:4.12'
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
}
/** 删除掉
* group = 'com.lizheng'
version = '1.0-SNAPSHOT'
description = 'myweb01'
java.sourceCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
*/
8、刷新插件进行下载
![在这里插入图片描述](https://img-blog.csdnimg.cn/33bc92fcbaec4f8b80f8f51520686c60.png#pic_center)
9、发布到tomcat中
![在这里插入图片描述](https://img-blog.csdnimg.cn/41daba8defc74db9a5670fe549f32473.png#pic_center)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)