How to convert a Maven build to Gradle?

MavenGradle

Maven Problem Overview


I know I should be working with my build.gradle and init.gradle files but I don't know what to write or how to point to my project folder with the pom.xml file.

Maven Solutions


Solution 1 - Maven

The first step is to run gradle init in the directory containing the (master) POM. This will convert the Maven build to a Gradle build, generating a settings.gradle file and one or more build.gradle files. For simpler Maven builds, this is all you need to do. For more complex Maven builds, it may be necessary to manually add functionality on the Gradle side that couldn't be converted automatically.

https://guides.gradle.org/migrating-from-maven/

Solution 2 - Maven

as Peter Niederwieser said:
> For more complex Maven builds, it may be necessary to manually add > functionality on the Gradle side that couldn't be converted > automatically.

although you have to write some parts manually by your self. there is an online service that may be an useful tool For complex Maven builds. maven2gradle is a project on github which can convert online dependencies element automatically from maven to gradle scripts.
for using it,

  1. get to maven2gradle . URL
  2. open and select contains of your maven file.
  3. Paste your maven dependencies on the text box in that web page (with or without the dependencies root element).
  4. click Convert button.

for more information http://sagioto.github.io/maven2gradle/

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3150054View Question on Stackoverflow
Solution 1 - MavenPeter NiederwieserView Answer on Stackoverflow
Solution 2 - MavenShadyarView Answer on Stackoverflow