gradle项目转换成maven项目

使用IDEA打开Gradle项目

1.在以下内容复制到build.gradle文件中。

apply plugin: maven
 
group = com.company.root
// artifactId is taken by default, from folder name
version = 0.0.1-SNAPSHOT
 
task writeNewPom << {
    pom {
        project {
            inceptionYear 2014
            licenses {
                license {
                    name The Apache Software License, Version 2.0
                    url http://www.apache.org/licenses/LICENSE-2.0.txt
                    distribution repo
                }
            }
        }
    }.writeTo("pom.xml")
}

2.运行右侧的install,即可在当前项目中生成 pom-default.xml文件,然后修改成pom.xml。

经验分享 程序员 微信小程序 职场和发展