Skip to main content

Build and Deployment Notes

Terminologies

Maven and Gradle

Classpath is a parameter that tells the Java compiler (javac) and the Java Virtual Machine (JVM) where to look for user-defined classes and packages. Just as your computer has a PATH variable to find executable programs, Java has a CLASSPATH to find .class files and libraries (.jar files).

When you run javac, you use the classpath to tell the compiler where the "blueprints" for your dependencies are.

javac -cp "lib/helper.jar" MyProgram.java


artifact: jar file

jar

k

Installation

You need a Java Development Kit (JDK) installed. Either set the JAVA_HOME environment variable to the path of your JDK installation or have the java executable on your PATH.

  • nvm: node version manager
  • mvn: maven

Maven Basics

mvn [options] [<goal(s)>] [<phase(s)>]

plugins have goal

mvn download dependencies and cache in a local repository. Different project share the same dependency => save disk space.

POM

A Project Object Model (or POM)

The groupId and the artifactId. These fields combine with a version to form the GAV coordinates (group, artifact, version), which uniquely, globally identifies a specific release of your package.
groupId typically specifies the company, organization, or open source project responsible for the library, whereas artifactId is the name for the specific library. GAV coordinates are often expressed with each part separated by a colon (:), such as org.apache.commons:collections4:4.4 or com.google.guava:guava:30.1-jre.

These coordinates are important not just for configuring your project locally. Coordinates act as the address for dependencies, so our build tooling can find them.

Artifacts

An artifact is a file with coordinates.

Artifact coordinates are most often represented as groupId:artifactId:version, or GAV in short.

  • groupId This element indicates the unique identifier of the organization or group that created the project. The groupId is one of the key identifiers of a project and is typically based on the fully qualified domain name of your organization. For example org.apache.maven.plugins is the designated groupId for all Maven plugins.
  • artifactId This element indicates the unique base name of the primary artifact being generated by this project. The primary artifact for a project is typically a JAR file. Secondary artifacts like source bundles also use the artifactId as part of their final name. A typical artifact produced by Maven would have the form <artifactId>-<version>.<extension> (for example, myapp-1.0.jar).

Building

k

Ant

No Built-in Dependency Management: Ant itself does not have built-in dependency management. You need to manually manage libraries by placing them in the classpath or integrating with external tools like Apache Ivy for dependency resolution.