[DevOps Bootcamp Notes] - Build Tools and Package Manager Tools

 [Notes] - Build Tools and Package Manager Tools

DISCLAIMER

This content has been shared under Educational and Non-Profit Purposes Only. No Copyright Infringement Intended, All Rights Reserved to the Actual Owner.

How to build the artifact?
Using a build tool

Specific to the programming languate
Java - Maven (or) Gradle

->Install dependencies
->Compile and compress your code

Build tools in Java:

JAR or WAR file

Maven(use XML) or Gradle(use Groovy code)

Build a Gradle project: ./gradlew build (inside "build" folder, "libs" folder ".jar" file will be generated)

Build a Maven project: mvn install

Before build a Maven project, we need to make sure the "spring-boot-maven-plugin" is added to the pom.xml.

(Inside "target" folder ".jar" file will be generated.)

How to run the application?
java -jar <name of the jar file>
java -jar .\build\libs\java-app-1.0-SNAPSHOT.jar
java -jar .\target\java-maven-app-1.1.0-SNAPSHOT.jar

Build JavaScript applications:
npm and yarn are package managers (not build tools). They will install dependencies, but not used for transpiling the JS code."package.json" is equivalent to "build.grade" or "pom.xml" in java or maven projects.

npm install - to install dependencies that are defined in package.json

npm-command line tool
npm start - start the application
npm stop - stop the application
npm test - run the tests
npm publish - publish the artifact

What does the zip/tar file include?
->It only includes application code, but NOT the dependencies. So when we are running the Java script artifacts(from the zip) we need to install the dependencies first and then run the JavaScript application.

1) Must install the dependencies first
2) Unpack zip/tar (copy artifact & package.json file to the server)
3) Run the App (npm run (or) node command)

To create an artifact:
npm pack

Run JavaScript application:
npm start

Build Tools and Docker:
No need to build and move different artifact types (e.g. jar,war,zip).

Just 1 artifact type - Docker image. We build docker images from the applications. No need for a repository for each file type. Additional advantage is no need to install dependencies on the server. We can execute install command inside the docker image.

-Docker Image is an alternative to all other artificat types
-You don't need to install npm or java on the server
-Execute everything in the image. But you still need to build the Apps!


──────── Credits to: TechWorldwithNana & BestTechReads ────────

DISCLAIMER

The purpose of sharing the content on this website is to Educate. The author/owner of the content does not warrant that the information provided on this website is fully complete and shall not be responsible for any errors or omissions. The author/owner shall have neither liability nor responsibility to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the contents of this website. So, use the content of this website at your own risk.

This content has been shared under Educational And Non-Profit Purposes Only. No Copyright Infringement Intended, All Rights Reserved to the Actual Owner.

For Copyright Content Removal Please Contact us by Email at besttechreads[at]gmail.com

Post a Comment

Previous Post Next Post