DevOps Classroom notes 26/Nov/2024

Continuous Integration

  • CI involves building the code and packaging the code
  • In a detailed pipeline whenever developers submit code (push/PR)
    • build the code
    • run unit tests
      • unit test report
      • coverage reports
    • Perform static code analysis
      • Checking whether the code is not violating standard/best practices
      • Scanning code for security issues
    • Package the application
  • Building the code
    • syntax checks
    • compilation
      • creates binary format
  • Languages such as
    • C/C++/Golang are compiler based
      Preview
    • python/nodejs are interpreter based
      Preview
    • .net/java are hybrid based
      Preview

Code compilation

  • Watch classroom video for examples of java
  • To solve the complexities of larger projects, build tools were created which compile and package the application
  • Java Build Tools:
    • Ant
    • Maven
    • Gradle

Java Packaging Formats

1. Java Archive (JAR)

  • Description: A JAR file is a compressed file format that aggregates multiple Java class files and associated metadata into a single file.
  • Purpose: It is primarily used for packaging Java applications or libraries for distribution. JAR files can also include resources like images and configuration files.
  • Executable JAR: A JAR can be made executable by including a MANIFEST.MF file that specifies the entry point of the application, allowing it to be run using the command java -jar filename.jar [2][3].

2. WAR (Web Application Archive)

  • Description: A WAR file is similar to a JAR but is specifically designed for web applications.
  • Structure: It contains all the resources needed for a web application, including servlets, JSP files, HTML pages, and libraries.
  • Deployment: WAR files are deployed on a web server or application server, such as Apache Tomcat or Jetty.

3. EAR (Enterprise Archive)

  • Description: An EAR file packages one or more JAR and WAR files into a single archive for enterprise applications.
  • Use Case: It is used in Java EE (Enterprise Edition) environments to deploy large-scale applications that may consist of multiple modules.
  • Components: An EAR can include EJB modules (JAR), web modules (WAR), and resource adapters.

4. Class Files

  • Description: Individual compiled Java classes are stored as .class files.
  • Usage: These files are typically organized into packages (directories) to avoid naming conflicts and manage access control.

5. Native Executables

  • Description: Java applications can also be packaged as native executables using tools like Launch4j or JSmooth.
  • Purpose: This allows Java applications to be run as standard executable files on operating systems without requiring the user to have the Java Runtime Environment (JRE) installed separately [6].

Summary

Java’s packaging formats, including JAR, WAR, EAR, class files, and native executables, facilitate effective organization, distribution, and deployment of Java applications across various environments. Each format serves specific purposes tailored to different types of applications and deployment scenarios.

Citations:
[1] https://www.oracle.com/java/technologies/jpl2-packages-java-archive.html
[2] https://stackoverflow.com/questions/804466/how-do-i-create-executable-java-program
[3] https://www.javatpoint.com/package
[4] https://www.microfocus.com/documentation/visual-cobol/vc60/VS2019/HHBUCHCOMP03.html
[5] https://www.tutorialspoint.com/java/java_packages.htm
[6] https://www.geeksforgeeks.org/how-to-create-a-exe-file-from-a-java-program/
[7] https://www.w3schools.com/java/java_packages.asp

Library

  • Library is reusable code
  • Libraries are created to avoid rewriting same code
  • Libraries are two types
    • internal:
      • developed by your organization
    • external
      • developed by some one else
  • Using these libraries created dependencies, so libraries are referred as dependencies
  • if the dependency has security issue your application also will have same security issue
  • All the applications use dependencies, now your build tools also needs to download dependencies.

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube