- How to move a project from Maven to Gradle
So I was pleased to be set the challenge by one of my clients, that as part of the delivery they wanted the code moved from Maven to Gradle.
After a bit of research (as well as some trial and error) I can take you through the steps that should be able to convert a Maven project to Gradle in about 5 minutes. (Note I've used IntelliJ but I would imagine this should be pretty much the same on any other IDE - or even if you're not using an IDE).
- Install Gradle on your machine. You can get the software from here.
- Check out (or copy) your code into a new directory. This is not strictly necessary but it makes things cleaner.
- cd into the directory that contains your pom.xml
- Run the command: run gradle init. This will create a new gradle project creating a build.gradle file based on your pom.xml. (Note this is an incubator feature but it seems to work quite well).
- Create a new IntelliJ project as follows: File -> New -> Project From Existing Sources. Select the build.gradle file you created in the previous step and choose the following defaults as in this dialog:
That's really all there is to it. A brand new Gradle project.
Here are some additional notes I found useful as a Gradle newbie:
- If you want to include files you already have in your existing Maven .m2 repo add mavenLocal() as a dependency.
- Your dependencies get downloaded here (the equivalent of .m2): .gradle/caches/modules-2/files-2.1
- This is the correct way to define jdk compatibility:def javaVersion = JavaVersion.VERSION_1_8;sourceCompatibility = javaVersion;targetCompatibility = javaVersion;
- To see the results of your tests as they are running add this method to your build.gradletest { testLogging { events "started", "passed", "skipped", "failed", "standardOut", "standardError" }}
- If you have repositories that need authentication see here.
Many thanks for sharing this Rational Java article with us here. I find it so constructive and educative at the same time. It has solved the problems that i had before bumping here.
ReplyDeleteHow many people could be the total in number as the participants?I will surely attend there for the betterment of the conference.write my essay
ReplyDeleteThanks for the article. It is exactly what i needed
ReplyDeleteI am running the command mentioned above but nothing happens Run the command: run gradle init. This will create a new gradle project creating a build.gradle file based on your pom.xml. (Note this is an incubator feature but it seems to work quite well).
ReplyDeleteI tried later again it worked. Thanks for posting such an easy way to migrating the project to gradle!!!!!.
DeleteYou have brought up a very wonderful points , regards for the post.
ReplyDeletebrother printer support
What about Maven plugins?
ReplyDelete(pubg) is better than anyone might have expected with refreshed tourist spots, trains, and a slight change in season.
ReplyDeleteI am very much pleased with the contents you have mentioned. I wanted to thank you for this great article. Cyberpunk Yellow Jacket
ReplyDeletewow information are greatful. Thanks for sharing this Rational Java article with us here. Kinemaster Lite
ReplyDeletePut more informative things on this blog page, and thanks for sharing this. Tekkadan Jacket
ReplyDeleteGreat information about wilderness for beginners giving the opportunity for new people. irish jacket
ReplyDeleteSlots Casino & Hotel - MapYRO
ReplyDeleteView 서산 출장마사지 the directions, 군산 출장샵 reviews and 성남 출장안마 information for Slots Casino & Hotel in Biloxi, MS. 아산 출장마사지 Slots Casino. 3131 N. 서울특별 출장안마 Gulfport, MS 38664, USA. (662) 739-3000. Website. http://bit.ly/2bwRdWz.
I really like the design and layout of your website. It's quite pleasing to blackfriday discount the eyes, which makes coming here and blackfryday sale visiting more frequently much more fun for me.
ReplyDelete