Popular understanding of Maven and Gradle

Source: Internet
Author: User
Tags pack
Popular understanding of maven and Gradle

There are a lot of beginners who don't understand ant, Maven, and Gradle, and I've compiled two very easy-to-understand expressions here. This is more intuitive than a lengthy, conceptual answer. (not involving how to use) Maven

MAVEN's starting point is to automatically solve the dependency problem on ant's basis, and Gradle is more advanced than Maven.

However, automatic resolution of dependencies is a high requirement for networking. Especially to visit some sites like Google to download dependencies.

The principle of MAVEN is that you define dependencies in a configuration file (Pom.xml), and then he adds all the dependencies to the MAVEN dependent repository (repository), but you don't have to download them manually, and Maven automatically downloads them.

For example: Your Web project requires access to MySQL, and you need to manually place the Java-jdbc-mysql.jar in the web-inf/lib/directory. With Maven, you only need to write the jar package in the specified configuration file (Pom.xml) that requires jdbc-mysql, or you can tell it which version you want, Web-inf/lib directory doesn't even need to have any jar packages.

Maven first import project, often error, may be dependent on the download is not complete. Also, pay special attention: If your workspace has multiple projects and dependencies, these dependent projects must also be published (install) through MAVEN to its local library (repository).

Just a tool, master the basic principles, the use of the IDE is very good integration, the few commands back down is good clean, install and so on, not difficult. Gradle

Project Automation Build Tools
Author: nonesuccess
Links: https://www.zhihu.com/question/30432152/answer/79547641
Source: Know

Say to the popular understanding, then there is no need to learn what theory, popular to just.
Popular saying: Gradle is packaged.

Do you think it's OK to solve your problem? If it doesn't work out, it's your problem that's not good enough. For example, I guess you should mention: Why packaging a release, packaging and publishing there are several common methods, why these common methods to choose Gradle, and so on.
For what I'm guessing, it's plain to say: For example, write Java programs in eclipse

Why you need to pack:
After the first write, right-click on the run is OK. But after all the program is published to the server or for others to use, you first can not let all the people who want to run a eclipse, the second impossible to publish the source code to everyone. So you need to publish your code in binary form, so that other environments are easy to run, which is packaging.
A lot of things to do when packaging, such as the user name and password in the configuration file, your local development and program actually run when the content is certainly inconsistent, so need to have two files, the development of the time with one, the actual running time with one. This is done repeatedly every time you pack, Ant lets you write these things into scripts in the form of XML and then run them automatically.

Why use Maven
Your project will use a lot of jar packages, such as you write a log to use a log4j bar, even the database to use a connector bar. These days to write a program without a spring are embarrassed to go out, download the spring package to open a look, dense and good dozens of jars, do not know which one to use. And even if you put all these jar packs in the first place, it's still a big possibility that you won't be able to run them because you have to rely on other jar packages. The day you want to upgrade a spring iteration, all the jar packs are going to start over, and you don't remember the jar packages that spring introduced.
So with Maven, you just have to configure that I want to use spring3, all the jar packages are downloaded to you, you run directly on the line. L want to upgrade the version, directly change 3 to 4, the new jar package is also for you to download.
And then.
It's convenient to use the Maven,jar package, but I have a lot of things to do when I pack, and then you'll find out that maven really doesn't know how to do these things and begins to miss Ant.
Gradle is also capable of working with MAVEN, working with Ant, writing scripts in groovy language, and expressing more power. That's what it means.

The simplified version is as follows:
Ant can automate the packaging logic. Maven can also automate packaging, and what it does more than ant is to help you download the jar package. But Maven's packaging logic is too rigid, too cumbersome to customize, and less useful than ant. Gradle is the one that can automatically drop the jar, write the script himself, and write scripts that are more useful than ant.

Please leave a message if you know more about MAVEN content

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.