Maven Notes – 23 Sept 2023
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
What is Maven?
---------------------------
Build tool
Dev in Java
For auto Java projects
From Apache
Open Source - FREE
Where it stands:
compile test pack
PLAN -> Code -> Code Ana -> Build -> UT -> Pack -> Archive -> Dep2Qa -> AT -> CC
---------------------------------------------------------------------------------
jenkins Artifactory
Why Build tool?
--------------------------
Build Process
----------------------
Copy src
Copy 3rd part
create a dir
Clean
Setup env
Build
UT
Package
---------------------------------
20 CODE TIMES --- 20 TIMES BUILD
--------------------------------
Automate it
--------------------------------
Java - Python - Shell - P
--------------------------------
Build tool
-----------
2 hours
Other
-----------------------------------------
Makefile -> Ant -> Maven -> Gradle
DNT - Nant -> Msbuild
========================================================
How to install it?
======================
- JDK
cd dir/
curl-o openjdk-11.0.2_osx-x64_bin.tar.gz https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz
tar -zxvf openjdk-11.0.2_osx-x64_bin.tar.gz
export JAVA_HOME=PATH
export PATH=$PATH:/$JAVA_HOME/bin
============================
Product
---------------------
mode1 - ant
mode - gral
mode 3 - maven
mode - py
do - msbuild
python - shell scripting
------------------------
DevOps
SYSTEM Pro | prod Pro
------------------------------
3 py Build Tool - 100s py
========================================================
How to install it?
======================
Download
extract
Set in path
C:\tools\apache-maven-3.8.5-bin\bin --> PATH
====================================================
=====================================================================
C:\Users\Rajesh Kumar>mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.116 s
[INFO] Finished at: 2023-09-23T11:06:41+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
goals
lifecycle
phase
<plugin-prefix>:<goal>
======================================================================
Maven
Plugins
Core feature --
Other feature
================================================
<plugin-prefix>:<goal>
jarfile: main class
==============================================
Soft dev life
LC Build Lifecycle (DevOpsX)
====================================================
PHASE GOAL
-------------------------------------------
Compile mvn Compile powered by Plugins
TEST mvn TEST powered by Plugins
Package mvn Package powered by Plugins
===============================================================
Project Name - DevOpsX
mvn archetype:generate -DgroupId=com.companyname.software -DartifactId=financialService -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
groupId=com.companyname.software
artifactId=financialService
archetypeArtifactId=maven-archetype-quickstart
interactiveMode=false
============================================
GROUP ID
artifactId
version
SNAPSHOT 1.0-SNAPSHOT 1.1-SNAPSHOT 1.1.1-SNAPSHOT
RELEASE 1.0 1.1 1.1.1
com.microsoft.msoffice
com.microsoft.msoffice.word
com.microsoft.msoffice.pp
com.microsoft.msoffice.excel
com.microsoft.msoffice.common
com.microsoft.msproject
com.microsoft.ageofempire
--------------------------------------------
package com.microsoft.msoffice.word
import com.microsoft.msoffice.common
Mavan is Dependency management system TOO.
-----------------------------------------------
DevOpsX
Code
- junit
- Chat
================================================================
mvn ---> POM.xml --> Local Repo(IF FOUND then set in Classpath) --> Download from CR to LR set in Classpath
LR - C:\Users\Rajesh Kumar\.m2
CR - https://repo.maven.apache.org/maven2/
===================================================================================
ANT MAVEN MSBUILD GRADLE
target goal target tasks
build.xml pom.xml default.msbuild build.gradle
CUSTOM CUSTOM
===================================================================================
What is junit
UT
----------------
JAVA junit
py pyunit
RUBY spec
---------------------------------------
package Chat
---------------------------
OPT#1 - 10000 lines
OPT#2 - pack -- jav1
you download'
maven download
pack -- dev2
100 lines
=======================================
compile
test
package
install
deploy