+91 9619904949
Maven For Java

Maven For Java

Maven is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.

Maven’s Objectives:-
Maven’s primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal, Maven deals with several areas of concern:-
Making the build process easy.
Providing a uniform build system.
Providing quality project information.
Encouraging better development practices.
Making the build process easy.

While using Maven doesn’t eliminate the need to know about the underlying mechanisms, Maven does shield developers from many details.

Providing a uniform build system:-
Maven builds a project using its project object model (POM) and a set of plugins. Once you familiarize yourself with one Maven project, you know how all Maven projects build. This saves time when navigating many projects.

Providing quality project information:-
Maven provides useful project information that is in part taken from your POM and in part generated from your project’s sources. For example, Maven can provide:
Change log created directly from source control.
Cross-referenced sources.
Mailing lists are managed by the project.
Dependencies used by the project.
Unit test reports including coverage.

Third-party code analysis products also provide Maven plugins that add their reports to the standard information given by Maven.

Providing guidelines for best practices development:-
Maven aims to gather current principles for best practices development and make it easy to guide a project in that direction. For example, specification, execution, and reporting of unit tests are part of the normal build cycle using Maven. Current unit testing best practices were used as guidelines:

Keeping test source code in a separate, but parallel source tree. Using test case naming conventions to locate and execute tests. Having test cases set up their environment instead of customizing the build for test preparation.

 

Maven also assists in project workflows such as release and issue management.

Maven also suggests some guidelines on how to lay out your project’s directory structure. Once you learn the layout, you can easily navigate other projects that use Maven.

 

While Maven takes an opinionated approach to project layout, some projects may not fit with this structure for historical reasons. While Maven is designed to be flexible to the needs of different projects, it cannot cater to every situation without compromising its objectives. If your project has an unusual build structure that cannot be reorganized, you may have to forgo some features or the use of Maven altogether.

What is Maven Not?

You might have heard some of the following things about Maven:-

Maven is a site and documentation tool.
Maven extends Ant to let you download dependencies.
Maven is a set of reusable Ant scriptlets.

 

While Maven does these things, as you can read above in the What is Maven? section, these are not the only features Maven has, and its objectives are quite different.

1 https://maven.apache.org/download.cgi Find latest version of Maven

 

2 Cd /tmp && wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz Download latest in /tmp

 

3 Tar -zxvf apache-maven-3.8.6-bin.tar.gz Extract project

 

mv apache-maven-3.8.6 /opt/maven Set maven home

 

4 echo ‘export M2_HOME=/opt/maven’| tee -a /etc/profile Set M2_HOME for binary environment

 

5 echo ‘export MAVEN_HOME=/opt/maven’| tee -a /etc/profile Set MAVEN_HOME

 

6 echo ‘ export PATH=${M2_HOME}/bin:${PATH}’| tee -a /etc/profile Set binary environment

 

7 source /etc/profile export configurations in current system environment
Ci Tool Jenkins

Ci Tool Jenkins

Jenkins:-

→ Jenkins is an Open-Source project Written in Java that runs on Windows, macOS, and Other Unix-like Operating Systems. It is free, Community Supported, and might be your first-choice tool for CI.

→ Jenkins automates the entire Software development life Cycle

→ Jenkins was Originally developed by Sun Microsystem in 2004 under the name Hudson.

→ The project was later named Jenkins when Oracle bought Microsystems.

→ It Can run on any major platform without any Compatibilities issues.

→ Whenever developers Write Code, we integrate all that Code of all developers at that point in time and we build, test, and deliver/Deploy to the client. This process is called CI/CD ..

→ Jenkins helps us to achieve fast development.

→ Because of CI, Now bugs will be reported fast and get rectified fast So the entire Software development happens fast.

Workflow of Jenkins:-

→ We Can attach git, Maven, Selenium, Sonarqube, and Artifactory plugins to Jenkins.

→ Once developers put Code in GitHub, – Jenkins pulls that Code & sends to Maven for build

→ Once the build is done Jenkins pulls that Code and sends it to Selenium for testing.

→ Once testing is done, then Jenkins will pull that Code and Send it to artifactory (archive) as per requirement and so on.

→ We Can also deploy codes with Jenkins.

Build means=( compile, code review, unit testing, Integration testing, packaging[tar,jar,exe] )

Advantages of Jenkins: –

 → It has lots of plug-ins available

 → You Can Write your own plug-in.

 → You Can use Community Plug-in.

 → Jenkins is not just a tool. It is a framework i.e.: – You Can do whatever you want All you need is plug-ins.

 → We Can attach Slaves (nodes) to Jenkins master. It instructs others (slaves) to do Job. If slaves are not available Jenkins itself does the job.

 → Jenkins also behaves as a crone Server Replacement. i.e.: – Can do the scheduled task.
 → It Can Create Labels

1 yum install yum install fontconfig java-11-openjdk.x86_64 install java

 

2 alternatives –config java the set version of java

 

3 cp /etc/profile /etc/profile_backup backup profile

 

4 echo ‘export JAVA_HOME=/usr/lib/jvm/ /usr/lib/jvm/jre_11_openjdk’ |tee -a /etc/profile export java development kit home

 

5 echo ‘export JRE_HOME=/usr/lib/jvm/jre’ | tee -a /etc/profile export JVM  home

 

6 source /etc/profile export configurations in the current system environment

 

7 wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo Download the stable repo for yum

 

8 rpm –import https://pkg.jenkins.io/redhat-stable/jenkins.io.key Import key for package signature verification

 

9 yum install jenkins Install Jenkins

 

10 systemctl start jenkins.service Start Jenkins service

 

11 systemctl enable jenkins.service Enable Jenkins service

what needs to learn in Jenkins?

‌Introduction to Jenkins 
‌      Introduction to Continuous Integration 
‌      Continuous Integration vs Continuous Delivery 
‌      Jenkins Overview 
‌      Characteristics and features 
‌      Architecture 
‌      Concepts and Terms 
‌      Benefits and Limitations 
‌Installation and Configuration 
‌      Jenkins Installation and Configuration 
‌      Plug-ins Overview 
‌      Integration with Git 
‌      Integration with Maven 
‌      Integration with Java 
‌      Installing plugins 
‌Setting up Build Jobs 
‌      Jenkins Dashboard 
‌      Create the first job 
‌      Running the first job 
‌      Manage jobs – failing, disable, update and delete 
‌      Pipeline with Jenkinsfile 
‌      Freestyle Project Configuration 
‌      Git Hooks and Other Build Triggers 
‌      Workspace Environment Variables 
‌      Parameterized Projects 
‌      UpstreamDownstream Projects and the Parameterized Trigger Plugin 
‌      Build a Java application with Maven using Jenkins 
‌Continuous Delivery Pipeline 
‌      Publishing Build Artifacts 
‌      Deployment Plug-in setup and configuration 
‌      Auto Deployment of build artifacts into the target server 
‌      Deploy a Java application with Maven using Jenkins 
‌      Executing selenium Functional Testing with deployment 
‌Management, Security and Best Practices 
‌      Managing and Monitoring Jenkins Server 
‌      Scaling Jenkins 
‌      Securing Jenkins 
‌      Adding Linux Node and executing job on it 
‌      Adding windows node and executing job on it 
‌      Configuring access control on Jenkins 
‌      Configuring role-based access control 
‌      Jenkins logs 
‌      Management 
‌      Credentials in Jenkins 
‌      Best Practices 
‌Jenkins Pipeline 
‌      Writing Jenkins Pipeline file for java application build and deployment 
‌      Storing Jenkins in git and configuring webhook 
‌      Difference between declarative and scripted pipeline 
‌      Specify an agent in the pipeline 
‌      Parameters in Pipeline 
‌      Schedule build in the pipeline 
‌      Webhook in pipeline 
‌      Approval in pipeline 
‌      Approval with timeout in the pipeline 
‌      Variables in pipeline 
‌      Email notification in the pipeline 
‌      Post-build action in the pipeline 
‌      Parallel stages in the pipeline 
‌      Condition in pipeline 
‌      Selenium Functional Testing in the pipeline 

Yum (Yellowdog Update Modified)

Yum (Yellowdog Update Modified)

 

Yum (Yellowdog Update Modified) is an RPM Packet Management system for Fedora, CentOS, Red Hat, OpenSuse, etc. Yum, history (list, info, summary, repeat, redo, undo, new) commands is added on the 3.2.25 version. So this works for every Linux Distros, which uses yum 3.2.25 or newer. Yum, history command is really useful in situations where the need to example roll back the latest yum activity or undelete some deletes or just see what is updated lately.
Yum history and Yum history list

yum history lists all the latest yum operations and yum history list all operations or just selected package operations

Listing all operations

[root ~]> yum history
### OR ###
[root ~]> yum history list
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
ID | Login user | Date and time | Action(s) | Altered
————————————————————–
45 | System <unset> | 2010-01-18 09:57 | I, U | 21
44 | User <username> | 2010-01-14 15:31 | Install | 1
43 | System <unset> | 2010-01-14 08:13 | Update | 19
42 | System <unset> | 2010-01-13 10:39 | I, U | 40
41 | System <unset> | 2010-01-11 07:59 | Update | 16
40 | System <unset> | 2010-01-08 07:58 | Update | 38
39 | System <unset> | 2010-01-07 08:39 | I, O, U | 39
38 | System <unset> | 2010-01-05 08:23 | O, U | 18
37 | User <username> | 2010-01-04 15:43 | Install | 1
36 | System <unset> | 2010-01-04 07:56 | Update | 66
35 | User <username> | 2009-12-30 10:07 | Install | 2
34 | User <username> | 2009-12-30 10:01 | Update | 15
33 | User <username> | 2009-12-30 08:14 | Install | 13
32 | System <unset> | 2009-12-29 07:52 | I, U | 26
31 | System <unset> | 2009-12-28 08:31 | E, I, U | 66
30 | System <unset> | 2009-12-23 12:11 | Update | 7
29 | System <unset> | 2009-12-22 13:59 | Update | 36
28 | User <username> | 2009-12-21 13:21 | Install | 1
27 | System <unset> | 2009-12-18 14:59 | Update | 56
26 | User <username> | 2009-12-18 08:46 | Install | 1
history list

Listing Arora browser operations

[root ~]> yum history list arora
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
ID | Login user | Date and time | Action(s) | Altered
————————————————————–
2 | User <username> | 2010-01-19 15:10 | Erase | 1
history list

Yum history info

Show full information by history ID.

Remove Arora browser

[root ~]> yum remove arora
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
Setting up Remove Process
[…]
=====================================================
Package Arch Version Repository Size
=====================================================
Removing:
arora i686 0.10.2-2.fc12 installed 3.7 M

Transaction Summary
=====================================================
Remove 1 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)

Is this ok [y/N]: y
[…]
Running Transaction
Erasing : arora-0.10.2-2.fc12.i686 1/1

Removed:
arora.i686 0:0.10.2-2.fc12

Complete!

Yum history list

[root ~]> yum history list
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
ID | Login user | Date and time | Action(s) | Altered
————————————————————–
2 | User <username> | 2010-01-19 15:10 | Erase | 1
1 | User <username> | 2010-01-19 14:55 | Update | 3
history list

Show history info for ID 2

[root ~]> yum history info 2
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
Transaction ID : 2
Begin time : Tue Jan 19 15:10:13 2010
Begin rpmdb : 2431:fe4c2c846fd45c9125fb8ab27542a27b22e0d3df
End time : 15:10:27 2010 (14 seconds)
End rpmdb : 2430:2eeb12b0b0f2ef3fcb31b4447b439e76e92e3866
User : User <username>
Return-Code : Success
Transaction performed with:
Installed rpm-4.7.2-1.fc12.i686
Installed yum-3.2.25-1.fc12.noarch
Installed yum-plugin-fastestmirror-1.1.24-2.fc12.noarch
Packages Altered:
Erase arora-0.10.2-2.fc12.i686
history info

Yum history summary

Shows summary of lates operations.

[root ~]> yum history summary
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
Login user | Time | Action(s) | Altered
————————————————————–
User <username> | Last day | E, U | 4
history summary

Yum history repeat

yum history repeat command repeats old operation by history ID.

[root ~]> yum history repeat 2
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* fedora: mirror.cogentco.com
* livna: rpm.livna.org
[…]
Repeating transaction 2, from Tue Jan 19 15:10:13 2010
Erase arora-0.10.2-2.fc12.i686
No package matched to remove
history repeat

Yum history undo

yum history undo simply undo operations by history ID.

Undo Arora browser erase

[root ~]> yum history undo 2
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
[…]
Undoing transaction 2, from Tue Jan 19 15:10:13 2010
Erase arora-0.10.2-2.fc12.i686
Resolving Dependencies
–> Running transaction check
—> Package arora.i686 0:0.10.2-2.fc12 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

=====================================================
Package Arch Version Repository Size
=====================================================
Installing:
arora i686 0.10.2-2.fc12 updates 1.1 M

Transaction Summary
=====================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
arora-0.10.2-2.fc12.i686.rpm | 1.1 MB 00:00
[…]
Running Transaction
Installing : arora-0.10.2-2.fc12.i686 1/1

Installed:
arora.i686 0:0.10.2-2.fc12

Complete!

History list after undo

[root ~]> yum history list arora
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
ID | Login user | Date and time | Action(s) | Altered
————————————————————–
3 | User <username> | 2010-01-19 15:35 | Install | 1
2 | User <username> | 2010-01-19 15:10 | Erase | 1
history list

Yum history redo

yum history redo simply redos operation from yum history by ID.

[root ~]> yum history redo 2
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
[…]
Repeating transaction 2, from Tue Jan 19 15:10:13 2010
Erase arora-0.10.2-2.fc12.i686
Resolving Dependencies
–> Running transaction check
—> Package arora.i686 0:0.10.2-2.fc12 set to be erased
–> Finished Dependency Resolution

Dependencies Resolved

=====================================================
Package Arch Version Repository Size
=====================================================
Removing:
arora i686 0.10.2-2.fc12 installed 3.7 M

Transaction Summary
=====================================================
Remove 1 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)

Is this ok [y/N]: y
[…]
Running Transaction
Erasing : arora-0.10.2-2.fc12.i686 1/1

Removed:
arora.i686 0:0.10.2-2.fc12

Complete!

Yum history new

yum history new command delete/clear old history listing.

[root ~]> yum history new
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
history new

[root ~]> yum history
Loaded plugins: dellsysidplugin2, fastestmirror, refresh-packagekit
ID | Login user | Date and time | Action(s) | Altered
————————————————————–
history list

Linux Questions-1

Q001:-How do you execute a UNIX command in the background?  
Script &, screen
Q002:-Explain iostat, vmstat and netstat.
 Iostat :- Report CPU statistics, and input/output statistics for devices and partitions.
 VMSTAT:- vmstat reports information about processes, memory, paging, block IO, traps, and CPU activity.
NETSTAT:- netstat displays a list of open sockets.
Q003:-Explain soft(symbolic)/hard link and difference.

A soft link is a pointer to something else in the file hierarchy. Thus it matters where on the visibly exposed hierarchy a file resides. This is why they can point to things on different filesystems, as long as they are mounted in a consistent spot.
Ex: ext2 partition mounted /mnt/a, reiserfs partition mounted /mnt/b, symlink /mnt/a/mylink -> /mnt/b/my_real_file
If b were unmounted, this link goes away. if a were mounted again as b, the association would also not work. this isn’t magic. There is time spent handling this redirection, that you don’t have with hard links. Accessing a symlink makes it need to find the symlink, realize it’s a symlink, then go to the actual file.

Hard link: different inodes representing the same physical location on the disk. Obviously can’t go outside of its partition boundaries (and be legal). Thus /file1 and /file2 are hard linked to the same physical location on the disk. There is no redirection here as there is with symlinks.

different
A hard link cannot span file systems.
A soft link can point to files anywhere on the network.
All hard links share the same inode number.
Each soft link has a unique inode number.
If you delete the source hard link file you can still access the other one. However, with a soft link, if you delete the source link, you cannot access the other one.
With a soft link, you can create a symbolic link to a file that does not exist yet. You cannot create a hard link unless the source file already exists.

Q004:-what is Kernel parameters?

Kernal parameters are nothing but all the parameters in
/etc/sysctl.conf here we can edit according to our requirements.

Q005:-How to check many CPUs have been used in your machine?

to check the how many CPUs are in the machine just type this
command #psrinfo to check the CPU spec
#psrinfo –v

Q006:-what is a daemon?

A process that runs in the background and performs a specified operation at predefined times or in response to certain events.

Q007:-I want to change the run level but the Users shall not be disturbed. how?

Init (run level)
systemctl list-units –type=target
systemctl isolate multi-user.target

Sysvinit Runlevel Systemd Target Function
0 runlevel0.target, poweroff.target System halt/shutdown
1,single,s System halt/shutdown Single-user mode
2,4 runlevel2.target, runlevel4.target, multi-user.target User-defined/Site-specific runlevels. By default, identical to 3.
3 runlevel3.target, multi-user.target Multi-user, non-graphical mode, text console only
5 runlevel5.target, graphical.target Multi-user, graphical mode
6 runlevel6.target, reboot.target Reboot
emergency emergency.target Emergency mode
Q007:-Disk have 5GB disk utilization even though files are unable to create, why?

(1)ACL
(2)inod
(3)over quata

Q008:-sar command o/p?
using sar we can see cpu user system iowait steal idl process statistics in other word sar Collect report or save system activity information. 
sar -bBcdqrRuvwWy -I SUM -I XALL -n ALL -P ALL CPU %user %nice %system %iowait %steal %idl
1 CPU usage: a. To get current CPU usage
# sar 2 10
# sar -p 2 10
# sar -P ALL 2 10b. To get the CPU usage for the previous date, consider 14th:
# sar -P ALL -f /var/log/sa/sa14c. To get the CPU usage for the 10th of the month, from 7 AM to 3 PM (i.e. specifying the time):
# sar -P ALL -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
2 Memory usage: a. To get current memory usage:
# sar -r 2 10b. To get the memory usage for the previous date, consider 14th:
# sar -r -f /var/log/sa/sa14c. To get the memory usage for the 10th of the month, from 7 AM to 3 PM (i.e. specifying the time):
# sar -r -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
Swap usage: a. To get current swap usage:
# sar -S 2 10b. To get swap usage for the previous date, consider 14th:
# sar -S -f /var/log/sa/sa14c. To get swap usage for the 10th of the month, from 7 AM to 3 PM:
# sar -S -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
Load Average: a. To get current load average stats:
# sar -q 2 10b. To get load average stats for the previous date, consider 14th:
# sar -q -f /var/log/sa/sa14c. To get load average stats for the 10th of the month, from 7 AM to 3 PM:
# sar -q -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
Paging usage: a. To get current paging usage:
# sar -B 2 10b. To get paging usage for the previous date, consider 14th:
# sar -B -f /var/log/sa/sa14c. To get paging usage for the 10th of the month, from 7 AM to 3 PM:
# sar -B -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
IO usage: a. To get current IO usage:
# sar -b 2 10b. To get IO usage for the previous date, consider 14th:
# sar -b -f /var/log/sa/sa14c. To get IO usage for the 10th of the month, from 7 AM to 3 PM:
# sar -b -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
Disk IO usage: a. To get current disk IO usage:
# sar -d -p 2 10b. To get disk IO usage for the previous date, consider 14th:
# sar -d -p -f /var/log/sa/sa14c. To get disk IO usage for the 10th of the month, from 7 AM to 3 PM:
# sar -d -p -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
Networking stats: a. To get current network device stats:
# sar -n DEV 2 10b. To get network device stats for the previous date, consider 14th:
# sar -n DEV -f /var/log/sa/sa14c. To get network device stats for the 10th of the month, from 7 AM to 3 PM:
# sar -n DEV -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
Power Management Stats: a. To get current power management usage:
# sar -m 2 10b. To get power management used for the previous date, consider 14th:
# sar -m -f /var/log/sa/sa14c. To get power management used for the 10th of the month, from 7 AM to 3 PM:
# sar -m ALL -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
Memory Stats (Page activities): a. To get current memory stats:
# sar -R 2 10b. To get memory stats for the previous date, consider 14th:
# sar -R -f /var/log/sa/sa14c. To get memory stats for the 10th of the month, from 7 AM to 3 PM:
# sar -R ALL -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00

 

 

 

 

 

 

 

Create a CSR using Openssl

Create a CSR certificate for your domain name with help with OpenSSL.

[root@server2 ~]# mkdir /etc/httpd/conf/ssl/csr/www.nitwings.com/ -p
You have new mail in /var/spool/mail/root
[root@server2 ~]# /usr/bin/openssl genrsa 2048 > /etc/httpd/conf/ssl/csr/www.nitwings.com/www.nitwings.com.key
Generating RSA private key, 2048 bit long modulus
……………………………………………………………………+++
…………………+++
e is 65537 (0x10001)
[root@server2 ~]# chmod go-rwx /etc/httpd/conf/ssl/csr/www.nitwings.com/www.nitwings.com.key
[root@server2 ~]# openssl req -new -key /etc/httpd/conf/ssl/csr/www.nitwings.com/www.nitwings.com.key > /etc/httpd/conf/ssl/csr/www.nitwings.com/www.nitwings.com.csr
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:Maharashtra
Locality Name (eg, city) [Default City]:Mumbai
Organization Name (eg, company) [Default Company Ltd]:Nitwings Pvt.Ltd
Organizational Unit Name (eg, section) []:SDU
Common Name (eg, your name or your server’s hostname) []:www.nitwings.com
Email Address []:[email protected]

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
You have mail in /var/spool/mail/root
[root@server2 ~]#cat /etc/httpd/conf/ssl/csr/www.nitwings.com/www.nitwings.com.csr

submit CSR to SSL provider.