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
- The basic build workflow
-
Building a Java Project:
- 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 2. The project which we want to build is Spring pet clinicgit clone https://github.com/spring-projects/spring-petclinic.git cd spring-petclinic mvn package 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)
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
- Once the feature is developed they have to release to the testing team.
- To deliver the features to the testing team
- Deliver Source Code
- Deliver the Build Artifacts
- Give the URL to start testing.
- Our Developers are working on features
Next Steps:
- Introduction to maven terms
- Understanding pom.xml
- Understanding repositories
- Maven build phases / life cycle
- Maven plugins
