The whole process can be divided into the following steps:
Compile source code
Run unit tests and integration tests
Perform static code analysis and generate analysis report.
Create a release version
Deploy to the target environment
Deploy the delivery process
Conduct smoke test and automatic function test.
If you perform each step manually, it is undoubtedly inefficient and error-prone. With automated construction, you only need to customize your construction logic and leave the rest to the tools.
Although both are project tools, maven is now the industry standard and Gradle is a rising star. Many people know him from Android Studio. Gradle abandoned Maven's tedious XML-based configuration. As we all know, the reading experience of XML is very poor. Although the machine is easy to identify, it is maintained by people after all. Instead, it adopts the configuration of Groovy, a domain-specific language, which greatly simplifies the number of lines of building code. For example, in Maven, you need to introduce a dependency:
& lt attribute & gt
& ltkaptcha.version & gt2.3 & lt/kapt cha . version & gt;
& lt/properties & gt;
& lt dependency & gt
& lt dependency & gt
& ltgroupId & gtcom . Google . code . kapt cha & lt; /groupId & gt;
& ltartifactId & gtkaptcha & lt/artifact id & gt;
& lt version & gt $ {kaptcha.version}</version >
& lt classifier & gt JDK15 < /classifier & gt;
& lt/dependency & gt;
& lt dependency & gt
& ltgroupId & gtorg.springframework & lt/groupId & gt;
& ltartifactId & gt spring core & lt/artifactid >
& lt/dependency & gt;
& lt dependency & gt
& ltgroupId & gtorg.springframework & lt/groupId & gt;
& ltartifactId & gt Spring beans & lt/artifactid >
& lt/dependency & gt;
& lt dependency & gt
& ltgroupId & gtorg.springframework & lt/groupId & gt;
& ltartifactId & gtspring-context</artifact id & gt;
& lt/dependency & gt;
& lt dependency & gt
& ltgroupId & gtjunit & lt/groupId & gt;
& ltartifactId & gtjunit & lt/artifact id & gt;
& lt/dependency & gt;
& lt/dependencies & gt;
Then I converted it into a Gradle script, and the result was amazing:
Dependency {
Compile ('org.springframework: spring-core: 2.5.6')
Compile ('org.springframework: spring-beans: 2.5.6')
Compile ('org.springframework: spring-context: 2.5.6')
Compile ('com.google.code.kaptcha: kaptcha: 2.3: JDK15')
test compile(“JUnit:JUnit:4.7”)
}
Note that the configuration has been reduced from 28 lines to 7 lines! This is not to mention some parent POM configurations that I omitted. Dependent groupId, artifactId, version, scope and even classifier, not a few. Compared with the XML configuration script of Maven or Ant, the Grovvy script used by Gradle is too lethal, and everyone loves beauty. Compared with the relaxed wrinkles of a 70-year-old woman, everyone definitely likes the girl's tight face, and XML is the wrinkles of that old woman.
Greer's biggest gain for me is two points.
One is simplicity. The compact script based on Groovy really makes people fondle it, and there is nothing unclear about expressing intentions.
The second is flexibility. All kinds of things that are difficult to do in Maven are a piece of cake in Gradle, such as modifying the existing build life cycle and completing several lines of configuration. Similarly, you have to write a plug-in in Maven, which is almost impossible for a novice user for a day or two.