miércoles, octubre 07, 2015

Gradle and Java EE


In the last years Apache Maven has become the de-facto build tool for Java and Java EE projects. But from two years back Gradle is gaining more and more users. In this post you are going to see how to use Gradle for Java EE projects.

Gradle is a build automation tool like Ant or Maven but introducing a Groovy-based DSL language instead of XML. So as you might expect the build file is a Groovy file.

There are different ways to install Gradle, but for me the best way is using sdkman tool. To install sdkman tool simply run:

$ curl -s get.sdkman.io | bash

After that you can init sdkman by running:

$ source "$HOME/.sdkman/bin/sdkman-init.sh"

With sdkman installed, installing Gradle is as easier as running:

$ sdk install gradle

Now you can start creating the build script. The first thing to do is creating a settings.gradle where in this case we are going to set the name of the project.

This file is also used in case of multiple module projects.

Last file you might need is one called build.gradle which manages all the build process.


Notice that the first line indicates that what you are going to build is a war project.  Then project properties are set like the group, version, description or Java compilation options. Finally only one dependency is required and with provided scope since the implementation is provided by the application server.

Note that providedCompile scope is only available if you are using the war plugin. If you are using another plugin like java, then you will need to implement this function by yourself (at least at the time of writing this post with Gradle  2.7).

And that's all, pretty compact, only 16 lines and no verbose information. Of course, now you will need to add more dependencies like JUnit or Arquillian with testCompile scope or any other extra library required in your code like the well known apache-commons dependency; But this is an story for another post.

We keep learning,
Alex.

Sun's in your eyes the heat is in your hair. They seem to hate you. Because you're there.  (Wonderful Life - Black)


39 comentarios:

Unknown dijo...

It would be great if you'd do a post on using https://spring.io/blog/2015/02/23/better-dependency-management-for-gradle with this, maybe Arquillian related? ;)

Unknown dijo...

Hehehe I had this in mind, but first I am waiting that the universe is released :)

Unknown dijo...

Do you think Maven is going into disuse?
Also not using xml, has Gradle another benefit against Maven?
Thanks.

Unknown dijo...

Not sure, I think that Maven has its market as well as Gradle. I would say that if you relay a lot on Maven plugins or your Jenkins pipeline contains a lot of logic for building the application and you feel comfortable and it works then Maven will continue be a solution, but on the other side if you feel that you need some extra power, and have a build script more compact, not spread between the application and the build pipeline, then Gradle might be your solution.

yanmaneee dijo...

vans shoes
curry 4
curry 6
balenciaga speed trainer
michael kors outlet
russell westbrook shoes
moncler outlet
yeezy boost 350
supreme clothing
goyard handbags

Assignment Help dijo...

Looking for some help with an assignment? We are providing a best online option where you can get online Assignment help
for your assignment at best price.

yanmaneee dijo...

kyrie spongebob
longchamp handbags
nike shoes
moncler outlet
timberland boots
westbrook shoes
michael kors purses
fila shoes
yeezy boost 350
adidas ultra

Jenifer dijo...

With an area of knowledge and skills, we are the most trusted brand in providing computer network assignment help. If you are in need of our service then you can reach us via email, live chat or over phone and discuss with us your assignment requirements.

Assignment help dijo...

Myassignmenthelp is an incomparable online assignment writing service delivering excellent Science assignment help service. Through a team of over 3000 subject experts we offer individual attention to every student making the assignment help experience completely unique and stress-free for students aiming to score high in every assignment. We even offer you free samples on our website that can be used as a quality reference to write a fresh piece of work and improve your grades.

Veronica Kate dijo...

The blog written is extremely impressive, with a great topic. However, a bit more research could have strengthened it even further. You can explore the services as offered by livewebtutors.com, a premium academic writing services platform offering the best of Plagiarism Checker Tool teamed with knowledge and experience.

Kaylee Brown dijo...

If you are worried about the thesis statement you want to put in your thesis, then you can take help from online thesis help websites. As you know the introduction is the main part of the thesis. People will first read this part. Once they are satisfied with this part, they will go ahead. So you need to go for thesis writing help to make your intro interesting. The thesis statement holds the gist of your thesis. You have to include all the key points of your thesis in this part. You always need to keep this portion clean. Do not use tough words here. Keep this part readable and understandable. Your thesis helper must have ideas of what you need to put here. Remember, if you cannot attract everyone to the thesis introduction, your thesis won’t be a successful one. So, write it accordingly and take the necessary tips and help from the writing company you have hired.

Okseoabhinav dijo...

The information you are providing that is really good. Thank for making and spending your precious time for this useful information. Thanks again and keep it up.
Top CA firm in India

cacpvtltd dijo...
Este comentario ha sido eliminado por el autor.
cacpvtltd dijo...

This article is enlightening lastly I got what I needed. Thanks much for this sort of data and keep it up. Audit firm in Delhi

Kaylee Brown dijo...

Writing a thesis can be particularly tricky. Thesis helpers understand how difficult it can be to write a research paper. Feeling stressed out is not something that anyone likes, and while tension is inevitable sometimes, it is entirely avoidable in case of writing your thesis.
How to Write A Thesis Assignment Help?
Step 1 - Identify the topic
Step 2 - Do some preliminary reading
Step 3 - Formulate a hypothesis or research question
Step 4 - Compile your bibliography and read, read and just read!
Step 5 - Outline your paper
Step 6 - Develop citations and bibliography
Step 7 - Take feedback and polish
How can cheap thesis writing help you with your thesis help?
● A thesis written from scratch
● All unique and original content
● High quality writing
● Timely delivery
● Unlimited revisions
● Free revisions
Looking for immediate help with your thesis? To help the students, a cheap thesis writing help team is available round the clock with advice and assistance.

Arvind Kumar Sahani dijo...

Quotesmystatus is the best website for quotes & status about love, success, funny, happy, sad, romantic and motivational etc. that will be downloaded quotes images and shared easily from our website. The best quote collection of inspiring, motivational quotes and funny memes about love, life, friendship, change and heartbreak for me and there is many quotes to share your partner and friends or family, Quotes, Love Quotes, Life Quotes, Vitamin B12 Sources in Hindi, Aloe Vera Ke Fayde In Hindi

Lillian J. Turner dijo...

Nice Blog. Thanks for sharing with us. Such amazing information.

Reasons why people stop following you on Instagram

Unknown dijo...

Visit
www.hp.com/go/wirelessprinting and open the door to the world of HP smart printing solutions. HP wireless printer is a versatile printing device that helps you print, scan, copy and fax your documents as per the requirement.
Visit ij.start.canon | ij.start canon and find out the best way to download Canon printer drivers. Canon printers are ideal for every situation wherever you need a document, paper, or photo print or even if you wish to scan, fax, and do more ijstart.canon will make you learn how to set up a canon printer to get advanced printing features.

Unknown dijo...

Canon IJ Network Tool is a toolkit software with the options to keep a check on most of your Canon printer network settings and adjust them according to your requirements. The Canon IJ Network tool will get you through the network settings uninterruptedly. Canon IJ Printer Utility is a complete software package meant to adjust and modify the configurations of your printer device as per the requirement.

mack zayn dijo...

ij scan utility
ij canon scan utility
Your scanned documents may be used for certain other purposes in other apps and software such as emails, PowerPoint presentations and so on.

Unknown dijo...

Visit
www.hp.com/go/wirelessprinting and open the door to the world of HP smart printing solutions. HP wireless printer is a versatile printing device that helps you print, scan, copy and fax your documents as per the requirement.

Unknown dijo...

Visit www.hp.com/go/wirelessprinting and open the door to the world of HP smart printing solutions. HP wireless printer is a versatile printing device that helps you print, scan, copy and fax your documents as per the requirement .

Unknown dijo...


Setting up your canon printer will take a few moments to get ready. However, it’s important to connect your inkjet printer and PC, Laptop with a wireless connection ij.start.canon , ij.start.cannon , Https //ij.start.cannon , Https //ij.start.cannon .

Shrainy Fogat dijo...

Read Newspaper Online list sorted by Countries and by languages. A huge collection of newspaper or epapers online from all over the world in various languages. Epaper hub contains Print edition epaper that you read Online and grab your news through internet. Here you can find any number of epaper in different language, from different cities, different countries and cities. So don’t wait and search you daily newspaper and enjoy news from all over the world online.

Unknown dijo...

ij.start.canon
is the manufacturer site to download Canon printer drivers. Install and set up Canon Printer from https: //ij.start.canon and obtain high-quality printing documents straightforwardly.

https//ij.start.cannon is actually the official site of ij start canon that helps you install the latest printer drivers and software. Visiting http //ij.start.cannon
provides you a complete list of all canon printers where you’ve to select your printer model and download the correct setup file

Unknown dijo...

Canon IJ Network Tool is a toolkit software with the options to keep a check on most of your Canon printer network settings and adjust them according to your requirements.

Canon IJ Printer Utility is a complete software package meant to adjust and modify the configurations of your printer device as per the requirement. It is one of the essential utility software offered by Canon to ease your printer configuration alteration using a few clicks.


Canon.com/ijsetup/mg2500
is the Canon support link to get you the latest printer drivers and software to set up your PIXMA MG2500 or MG2520.

John Ruth dijo...

Nice blog. I'm Appreciate your written skills.

123.hp.com/laserjet | 123.hp.com/laserjet | mywifiext setup |
ij.start.canon ts3122 | ij.start.canon

John Ruth dijo...

microsoft365.com/setup/family | microsoft365.com/setup/personal | microsoft365.com/setup/business | www.hp.com/go/wirelessprinting

Halovo Wario dijo...

Would you be interested in exchanging links?

Linkfly.to
Information
Click Here
Visit Web

Unknown dijo...

Make sure the surface where you are placing the printer is clean and close to Pc or laptop.Check the shipped components with your inkjet printer
http //ij.start.canon,
https //ij.start.cannon

Unknown dijo...

Allows you to download, install, and configure setup on your PC, Mac and smartphones as well. Canon ij setup is the software to install Canon printer wirelessly.
ij.start.canon,
ij.start canon

Unknown dijo...

Canon IJ Network Tool will get you through the network settings uninterruptedly. It is essentially required when you are attempting to get your printer connected to a different network because a new network tends to reset the printer’s existing network settings.The Canon IJ Printer Utility can be used to keep a check on your printer’s ink levels and cartridges and clean the ink tanks and paper feed rollers. Also, you can make adjustments to your Canon printer’s power settings.

charles dijo...

Nice website. Love it. This is really nice.
hbomax/tvsignin
disneyplus.com/begin
hbomax.com/tvsignin
disneyplus com login begin

Unknown dijo...


Once you are done with the driver setup via canon.com/ijsetup , you will have to insert a pile of pages into the printer tray for printing the documents..

Visit ij.start.canon | ij.start canon and find out the best way to download Canon printer drivers.

All-in-one Canon Inkjet printers are suitable for home, business, school, and others to improve productivity. You can easily set up your Canon printer through drivers from Canon.com/ijsetup , wireless connection, USB, and a few components.

James K. dijo...

The ij.start.cannon setup process for every Canon model is almost similar, however the download through https //ij.start.cannon and http //ij.start.cannon installation process may differ. you can also visit canonsetup-canon.com/ijsetup website for same. Https //ij.start.cannon.Depending on your requirement, it offers a type printer including PIXMA, SELPHY, MAXIFY, etc. canon.com/ijsetup

Unknown dijo...

Canon drivers fully support and assists for all compatible products for all Window versions. We offer the required data to configure, utilize and install your Canon products on your Windows PC.canon is completely safe and secure. ij.start.canon |
ij.start.cannon

Simon Frank dijo...

Canon inkjet printers are widely used all over the globe. It’s the combination of ink, print text, images, and graphics print output. These models are easy to use and offer outstanding creative printing solutions Canon.com/ijsetup , Canon.come/ijsetup.

Unknown dijo...

It’s the online support platform to download and install canon printer drivers, firmware, and software. To get started with ij.start canon setup, you can select wireless, wired, or USB connection method.
ij.start.canon,
ij.start canon

pherten dijo...

f0n12b2x25 u2b91z0o69 s2m04d7n63 y4u38f5c48 a8x21l7g28 c3c28i4k47