Build tools

Build tools try to Automate some of Developer tasks :

  • Compiling source code into Binary
  • Packaging that Binary code
  • Running tests
  • Deployment to other systems (QA/UAT/PROD)

3 of biggest Java build tools :

  • Ant
    • Released in July 2000
    • XML configuration
    • You can still see this in Legacy projects
  • Maven
    • Dependency management
    • Plug-in based architecture
    • XML Configuration
  • Gradle
    • pretty new
    • builds on Ant & Maven
    • uses Groovy based DSL(Domain Specific Language) – creating build files much more expressive.
    • Multi-project builds

Maven

Parent POM – Maven users can inherit from the spring-boot-starter-parent project to obtain sensible defaults. A Dependency management section, allowing you to omit <version> tags for common dependencies, inherited from the spring-boot dependencies POM.

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>2.0.0.BUILD-SNAPSHOT</version> 
    <relativePath/> <!-- lookup parent from repository --> 
</parent>

Project Dependencies :

Declare your dependencies.

<dependencies> 
    <dependency> 
        <groupId>org.springframework.boot</groupId> 
        <artifactId>spring-boot-starter-web</artifactId> 
    </dependency>
    <dependency> 
        <groupId>org.springframework.boot</groupId> 
        <artifactId>spring-boot-starter-test</artifactId> 
        <scope>test</scope> 
     </dependency> 
</dependencies>

Spring Boot includes a Maven plugin that can package the project as an executable JAR. Add the plugin to your <plugins> section if you want to use it.

<build> 
   <plugins> 
       <plugin>
          <groupId>org.springframework.boot</groupId> 
          <artifactId>spring-boot-maven-plugin</artifactId> 
       </plugin> 
    </plugins> 
</build>

 

Gradle :

Good course on learning Gradle :

https://in.udacity.com/course/gradle-for-android-and-java–ud867