DevOps Classroom Series – 22/Sept/2020

What is a Build Tool?

  • These tool automate building & packaging the software project.

  • Activities

    • Compiling source code
    • Packaging Compiled source code into package formats (JAR/EXE/MSI/ZIP/TAR/WAR/dll etc)
    • Dependency Management
    • Releases to Artifact Repository
    • Generating Documentation from source code
  • Popular Build Tools

    • Java: Maven, Gradle, Ant
    • DotNet: MsBuild
    • nodejs: Gulp, grunt
    • C/C++: make, cmake, bmake etc..
  • When we build the package we get some files/anything they are called as build artifacts

  • General Workflow:

    • The basic build workflow Preview
  • Building a Java Project:

    1. Lets create a new ec2 instance and install the java and maven
    sudo apt-get update
    sudo apt-get install openjdk-8-jdk maven git -y
    git --version
    mvn --version
    java -version
    

    Preview 2. The project which we want to build is Spring pet clinic

    git clone https://github.com/spring-projects/spring-petclinic.git
    cd spring-petclinic
    mvn package
    

    Preview 3. As the project grows we need a tool to manage dependencies & simplify build process

Maven Core Concepts

  • Basic Workflow
    • For every project create a xml file which is called as POM (Project Object Model)
    • In this xml file we represent resources (code, test code, dependencies)
    • Maven will read pom.xml file and then execute Goals (compile, test, clean, package) Preview

Maven Core advantages

  • Maven believes in conventions over configuration.

  • Maven has a strong dependency management system. It uses repository based system.

  • Maven has a huge central repository hosted Refer here on the internet

  • Every machine where maven is installed has a local repository (~/.m2)

  • Your organization can opt for remote repository

  • Scenario: LT-HMS

    • Our Developers are working on features Preview
    • Once the feature is developed they have to release to the testing team.
    • To deliver the features to the testing team
      1. Deliver Source Code
      2. Deliver the Build Artifacts
      3. Give the URL to start testing.

Next Steps:

  • Introduction to maven terms
  • Understanding pom.xml
  • Understanding repositories
  • Maven build phases / life cycle
  • Maven plugins

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin