SlideShare a Scribd company logo
Building and Managing
Java Projects with Maven
Part-II
Create a New Project
Type:
maven genapp
It will prompt for
– project id
– project name
– project package name
A Sample Service J2EE Project
• EJB (stateless session beans exposed as web
services)
• Data components
• Web application
Directory Layout
Project Directory Layout
sampleservice
– project.xml - Master POM of the project
– maven.xml - Reactor definition
– project.properties - Properties related to the project
– application/ - Application component
– service-data/ - Common data component
– service-ejb/ - EJB/WS component
– service-web/ - Web Application component
– target/ - Generated artifact directory
– xdocs/ - Various documents in xml format
– …
Directory Layout
A Component Directory Layout
…
service-data - Data component subproject
– project.xml - POM of the data project
– maven.xml - Goals definition
– project.properties - Properties related to the project
– src/ - Source directory
– conf/ - Configuration and resource files
– java/ - Java source files
– test/ - Test source files
– target/ - Generated artifact directory
– xdocs/ - Various documents in xml format
…
Project Object Model (POM)
Projects are described as Project Object Model.
• Project Management
– Detailed description of the project.
– Company information.
– Developer roles and information.
– Mailing list and source control modules
configuration.
• Project Build
– Source code and test code location.
– Resources location
Project Object Model (POM)
• Project Dependency
– Libraries needed for build and runtime.
• Project Reports
– Junit reports
– Javadoc reports
– Checkstyle reports, ….etc
Project Management Section
<project>
<pomVersion>3</pomVersion>
<groupId>sampleservice</groupId>
<name>Sample Service</name> <!-- Used in Javadoc -->
<id>sampleservice</id>
<currentVersion>1.0</currentVersion>
<!-- Used for document creation -->
<organization>
<name>My, Inc.</name>
<url>http://www.myinc.com</url>
<logo>/images/logo.gif</logo>
</organization>
…
(elements in bold are required)
Project Management Section
<project>
[…]
<inceptionYear>2003</inceptionYear> <!-- Used in JavaDoc –
<package>com.myinc.sampleservice</package> <!-- Used in JavaDoc -->
<shortDescription>Demo to use maven</shortDescription> <!-- one liner -->
<!-- Used in front page-->
<description>
A detailed description about this demo
</description>
<url>http://www.myinc.com/sampleservice/</url>
<issueTrackingUrl/>
<siteAddress>dev.myinc.com</siteAddress> <!-- Used in deployment -->
<siteDirectory>/www/sampleservice/</siteDirectory> <!-- Used in deployment -->
<!-- Used in deployment. If defined, it overrides ${maven.repo.central} -->
<distributionSite>/www/dist/sampleservice</distributionSite>
<!-- Used in deployment, final distribution directory -->
<distributionDirectory>/www/www.myinc.com/somedir</distributionDirectory>
Project Management Section
<project>
[…]
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.myinc.com:/cvsroot:samples
ervice</connection>
<developerConnection>scm:cvs:pserver:${maven.username}@cvs.myinc.
com:/cvsroot:sampleservice</developerConnection>
<url>http://cvs.myinc.org/viewcvs/sampleservice/</url>
</repository>
<!-- Used in maven:dist -->
<versions>
<version>
<id>1.0-beta-1</id>
<name>1.0-beta-1</name>
<tag>1.0-beta-1</tag>
</version>
</versions>
<branches/>
[…]
…
<mailingLists/>
<contributors/>
<developers/>
…
Project Dependency Section
<project>
[…]
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
<properties>
<ear.bundle>true</ear.bundle>
<ejb.manifest.classpath>true</ejb.manifest.classpat
h>
</properties>
</dependency>
</dependencies>
[…]
Special Dependency:
SNAPSHOT
Project Dependency Section
Dependency Classloader
[…]
<dependency>
<groupId>bcel</groupId>
<artifactId>bcel</artifactId>
<version>5.1</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
[…]
Maven has three classloaders:
root -- ant classloader
root.maven – maven core classloader
default – plugin classloader
Project Dependency Section
Dependency Override
project.xml
…
<dependency>
<groupId>weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>8.1.1</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
project.properties
…
## Dependency override
maven.jar.override = on
maven.jar.weblogic = ${weblogic.home}/lib/weblogic.jar
maven.jar.webservices = ${weblogic.home}/lib/webservices.jar
Project Build Section
Defines the location of source, test and resource files.
[…]
<build>
<nagEmailAddress>buildmaster@myinc.com</nagEmailAddress>
<sourceDirectory>${src.java.dir}</sourceDirectory>
<unitTestSourceDirectory>${src.test.dir}</unitTestSourceDirectory>
<aspectSourceDirectory/>
[…]
src/aspect
src/test
src/java
Project Build Section
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<resources/>
</unitTest>
<resources>
<resource>
<directory>${src.conf.dir}</directory>
<targetPath/>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
src/co
nf
prefix package name,
e.g. com.myinc.
sampleservice
Project Report Section
Defines various reports to be generated
<reports>
<report>maven-jdepend-plugin</report>
<report>maven-checkstyle-plugin</report>
<report>maven-changelog-plugin</report>
<report>maven-developer-activity-plugin</report>
<report>maven-file-activity-plugin</report>
<report>maven-javadoc-plugin</report>
<report>maven-jxr-plugin</report>
<report>maven-junit-report-plugin</report>
<report>maven-linkcheck-plugin</report>
<report>maven-tasklist-plugin</report>
</reports>
Project Report - Example
Jakarta Turbine
Project Report - XDoc
xdocs/navigation.xml
…
<menu name="General Information">
<item name="Overview" href="/index.html"/>
<item name="Features" href="/features.html"/>
<item name="Specification" href="/fsd.html"/>
<item name="Getting Started" href="/getting-started.html"/>
</menu>
xdocs/features.xml
<document>
<properties>
<title>Turbine Features</title>
<author email="">Jon S. Stevens</author>
</properties>
<body>
<section name="Features">
<p>This document is for bragging about all of Turbine's ….
…
</document>

More Related Content

PPT
Training in Android with Maven
PPTX
Building and Managing Projects with Maven
PPTX
Building and managing java projects with maven part-III
PPTX
Mule esb
PDF
Web components - An Introduction
PPSX
JSP - Part 2 (Final)
PDF
Jsf Framework
PDF
Lecture 9 - Java Persistence, JPA 2
Training in Android with Maven
Building and Managing Projects with Maven
Building and managing java projects with maven part-III
Mule esb
Web components - An Introduction
JSP - Part 2 (Final)
Jsf Framework
Lecture 9 - Java Persistence, JPA 2

What's hot (18)

PPTX
The Drupal Strongarm Module - Tips and Tricks.
KEY
Intro to Features Module on Drupal
PPTX
Session 35 - Design Patterns
PPTX
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
PDF
Weblogic configuration
PPTX
Session 39 - Hibernate - Part 1
PPTX
Session 32 - Session Management using Cookies
PPTX
Session 37 - JSP - Part 2 (final)
ODP
Java Web Programming [1/9] : Introduction to Web Application
PPTX
Session 34 - JDBC Best Practices, Introduction to Design Patterns
PPT
Lecture 19 dynamic web - java - part 1
PDF
Java Web Programming [4/9] : JSP Basic
PPTX
Session 36 - JSP - Part 1
PPTX
Session 40 - Hibernate - Part 2
PPTX
Session 25 - Introduction to JEE, Servlets
PPTX
Session 28 - Servlets - Part 4
PPT
J2EE - JSP-Servlet- Container - Components
PPT
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[
The Drupal Strongarm Module - Tips and Tricks.
Intro to Features Module on Drupal
Session 35 - Design Patterns
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Weblogic configuration
Session 39 - Hibernate - Part 1
Session 32 - Session Management using Cookies
Session 37 - JSP - Part 2 (final)
Java Web Programming [1/9] : Introduction to Web Application
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Lecture 19 dynamic web - java - part 1
Java Web Programming [4/9] : JSP Basic
Session 36 - JSP - Part 1
Session 40 - Hibernate - Part 2
Session 25 - Introduction to JEE, Servlets
Session 28 - Servlets - Part 4
J2EE - JSP-Servlet- Container - Components
Tutorial: Writing Sencha Touch Mobile Apps using ]project-open[
Ad

Viewers also liked (18)

PDF
DOCX
Evidencia 021
PPTX
PDF
990906成果報告
PDF
Mentallopedia quiz 2015
DOCX
CHARLES NJOROGE C.V_2
PDF
花蓮縣卓溪鄉卓樂國小99學年度校園生活百句(母語)
PPTX
Mule for each scope headerc ollection
PDF
Ryne Bessler: BASSET Certification
PDF
Manual de Marca Salinas de Chile
PPTX
What We Do | Rocky Mountain Institute-Carbon War Room
PDF
Design thinking workshop 3 horas
PDF
El diseño de servicios
PDF
NEFROLOGIA CLINICA: Gn. Membranoproliferativa
PPTX
Glomerulonefritis rapidamente progresiva
PPSX
Diego brito p.
PPTX
Presentación de estrategias depro comunicación
PPT
la comunicacion por byron perugachi
Evidencia 021
990906成果報告
Mentallopedia quiz 2015
CHARLES NJOROGE C.V_2
花蓮縣卓溪鄉卓樂國小99學年度校園生活百句(母語)
Mule for each scope headerc ollection
Ryne Bessler: BASSET Certification
Manual de Marca Salinas de Chile
What We Do | Rocky Mountain Institute-Carbon War Room
Design thinking workshop 3 horas
El diseño de servicios
NEFROLOGIA CLINICA: Gn. Membranoproliferativa
Glomerulonefritis rapidamente progresiva
Diego brito p.
Presentación de estrategias depro comunicación
la comunicacion por byron perugachi
Ad

Similar to Maven II (20)

PPTX
Maven ii
PPTX
Maven ii
PPT
PPT
Maven introduction in Mule
PPT
PPT
Maven
PPT
PPT
Maven in Mule
PPTX
Apache Maven
PPT
Intro to-ant
PPTX
Maven iii
PPTX
Maven iii
PPTX
Maven part 3
PDF
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
PPT
Juggling Java EE with Enterprise Apache Maven
PPTX
Spring data jpa are used to develop spring applications
PDF
Oracle 12c Launch Event 02 ADF 12c and Maven in Jdeveloper / By Aino Andriessen
PDF
Introduction to Maven
PDF
Hands On with Maven
PPTX
Angular or React
Maven ii
Maven ii
Maven introduction in Mule
Maven
Maven in Mule
Apache Maven
Intro to-ant
Maven iii
Maven iii
Maven part 3
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
Juggling Java EE with Enterprise Apache Maven
Spring data jpa are used to develop spring applications
Oracle 12c Launch Event 02 ADF 12c and Maven in Jdeveloper / By Aino Andriessen
Introduction to Maven
Hands On with Maven
Angular or React

More from princeirfancivil (20)

PPTX
Web services uddi
PPTX
Web services wsdl
PPTX
Web services SOAP
PPTX
WebServices introduction
PPTX
Introduction to java
PPTX
Maven part 1
PPT
Anypoint data gateway
PPTX
Data weave
PPTX
How to use expression filter
PPTX
How to use message properties component
PPTX
Mapping and listing with mule
PPTX
Mmc rest api user groups
PPTX
PPT
Mule esb api layer
PPTX
Mule esb stripe
PPTX
PPT
Mule security jaas
PPT
Mule security saml
Web services uddi
Web services wsdl
Web services SOAP
WebServices introduction
Introduction to java
Maven part 1
Anypoint data gateway
Data weave
How to use expression filter
How to use message properties component
Mapping and listing with mule
Mmc rest api user groups
Mule esb api layer
Mule esb stripe
Mule security jaas
Mule security saml

Recently uploaded (20)

PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Approach and Philosophy of On baking technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Spectroscopy.pptx food analysis technology
PDF
KodekX | Application Modernization Development
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Empathic Computing: Creating Shared Understanding
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation_ Review paper, used for researhc scholars
Approach and Philosophy of On baking technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Digital-Transformation-Roadmap-for-Companies.pptx
sap open course for s4hana steps from ECC to s4
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
Review of recent advances in non-invasive hemoglobin estimation
Spectroscopy.pptx food analysis technology
KodekX | Application Modernization Development
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Empathic Computing: Creating Shared Understanding
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.

Maven II