Friday, January 20, 2017

Gradle to maven conversion and vice versa

How to convert maven to gradle
The first thing is, you have to install gradle. Its easy. I know you can do it.  Go to the installing guide: http://www.gradle.org/docs/current/userguide/installation.html
Now the second step is to run ‘gradle init‘ in the directory containing the POM file. This will  convert the maven build to a gradle build generating a setting.gradle file and one or  ore more build.gradle files.
Thats all.
How to convert gradle to maven
You just need to add  a maven plugin in your build.gradle.
Your build gradle should be 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'
}
Now run ‘gradle install‘ in the build.gradle folder.
Now you will find in the build/poms subfolder, a file called pom-default.xml which will contain the dependencies.

Now its all yours, copy it, customise it add up new stuff.

Resource Link:

  1. https://codexplo.wordpress.com/2014/07/20/gradle-to-maven-conversion-and-vice-versa/
  2. Gradle build.gradle to Maven pom.xml

No comments:

Post a Comment