Archives

Maven – Introduction

Maven Project

Download mysql connector jar
right version ???
– manual download
– version may change day wise
– manual add jars

Open source companies published jar in Maven
– auto download
– download recent version
– jars added automatically
– internet connection is required
– jars will be downloaded to local repository
NOTE: consecutive download will check in local
If not present then Maven downloads from internet

Maven Project Steps
1) Create File -> Other -> New Maven Project
2) Group id
– com.janani
3) Artifact id
– bookapp
4) Folder Structure
– src -> main -> java ( Business Logic Files ) ( it will be jar)
– src -> test -> java ( Test Files )
5) pom.xml
– group id
– artifact id
– version (major.minor.defect)

https://mvnrepository.com
– to download recent jars from internet

Jars
1) mysql connector(C:\Users\EP\.m2\repository\mysql\mysql-connector-java\6.0.5)
2) lombok
3) commons dbcp2
4) spring-jdbc
NOTE: download from central

Downloaded Jars will be available in local repository
– C:\Users\JananiVelmurugan\.m2\repository

Maven Life Cycle
– mvn clean
– mvn compile
– mvn test
– mvn package
– mvn install

Maven Steps
– Right click project -> Run as -> maven clean

https://github.com/JananiVelmurugan

Outcome
– Should able to create maven core project
– Should able to create maven web project

Steps:
1) Create database and tables
2) Create a maven core project
2.1) Add maven dependencies
2.2) Add properties
2.3) Right click project -> Maven -> Update Project
2.4) Right click project -> Run as -> Maven Install
2.5) Create packages and classes in src\main\java
Format:
com.<>.<>.<>
2.6) Create test classes in src\test\java

create xampp->htdocs-> create a new folder

V1_1__CREATE_TABLE

Advertisements

Maven – web.xml (Web Project)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	id="WebApp_ID" version="3.1">
</web-app>

Maven (web app) Properties

	<properties>
		<failOnMissingWebXml>false</failOnMissingWebXml>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
	</properties>