DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Java
  4. How to Convert Maven to Gradle and Vice Versa

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.

A N M Bazlur Rahman user avatar by
A N M Bazlur Rahman
CORE ·
Dec. 18, 16 · Tutorial
Like (18)
Save
Tweet
Share
202.21K Views

Join the DZone community and get the full member experience.

Join For Free

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.

Apache Maven Gradle Convert (command)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top 10 Best Practices for Web Application Testing
  • Old School or Still Cool? Top Reasons To Choose ETL Over ELT
  • Seamless Integration of Azure Functions With SQL Server: A Developer's Perspective
  • A Beginner's Guide to Infrastructure as Code

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: