Gradle and MAVEN projects transform each other

Source: Internet
Author: User

Gradle has developed rapidly over the years, and a growing number of GitHub projects are beginning to be built using Gradle, but not everyone is familiar with Gradle, and the following approach can turn Gradle into a maven project, Premise Gradle The project directory structure remains the same as Maven's, that is,/src/main/java this set.

One, Gradle---maven

Add the following in Build.gradle (Group,version can modify itself, artifactid default to the directory name)

Apply plugin: ' java '

Apply plugin: ' maven '

Group = ' Com.101tec '

Version = ' 0.7-dev '

Sourcecompatibility = 1.6

Then./gradlew build, after success will be generated in the Build\poms directory Pom-default.xml file, copy it to the root directory, renamed to Pom.xml can

Of course, you can also generate pom.xml directly from the root directory by modifying Build.gradle.

Task Writenewpom << {    Pom {        Project {            inceptionyear '            licenses {                license                    { Name ' The Apache software License, Version 2.0 '                    url ' http://www.apache.org/licenses/LICENSE-2.0.txt '                     distribution ' Repo '}}}    }.writeto ("$buildDir/pom.xml")}     

Two, maven--Gradle

First of all, ensure that the machine installed Gradle 2.0 or more versions

Then run it under the MAVEN root directory

Gradle init--type Pom

Further instructions on Gradle and how to use them are described in: https://lippiouyang.gitbooks.io/gradle-in-action-cn/content/gradle/gradle-features.html

Gradle and MAVEN projects transform each other

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.