Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Convert Maven to Gradle and Vice Versa

DZone's Guide to

How to Convert Maven to Gradle and Vice Versa

Converting Maven to Gradle only takes one step, and converting Gradle back to Maven isn't much more difficult.

Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

To convert Maven to Gradle, the only step is to run gradle init  in the directory containing the POM. This will convert the Maven build to a Gradle build, generating a settings.gradle file and one or more build.gradle files. 

That's all!

To convert Gradle to Maven, first, Maven plugin need to be added in the build.gradle file. 

build.gradle should look like this: 

apply plugin: 'java'
apply plugin: 'maven'
 
group = 'com.bazlur.app'
// artifactId is taken by default, from folder name
version = '0.1-SNAPSHOT'
 
dependencies {
compile 'commons-lang:commons-lang:2.3'
}

Then, simply run Gradle install in the directory.

Lastly, simply run gradle install and the directory containing build.gradle will do the job. It will create pom-default.xml in the build/poms subfolder.

The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

Topics:
gradle ,maven ,integration

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}