We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
Build management
¢ It is the process of compiling and assembling
a software system
¢ Build automation is the act of scripting or
automating a wide variety of tasks
— Compiling source code
— Packing binaries
— Running automated tests z b
— Deploying to production system _
— Creating documentation* What is Maven?
“Maven is a project management tool which encompasses
a project object model, a set of standards, a project
lifecycle, a dependency management system, and
logic for executing plugin goals at defined phases in a
lifecycle”
* Maven provides superset of features found in a build tool
* Maven manages project build, reporting, and
documentation from a central piece of informationMain Features of MAVEN
> Build-Tool
>» Dependency Management Tool
> Documentation Tool
N= = ~ CJ
- ——_ Apache Maven Project
> ; a Maven
Welcome to Maven 2Overview of Simple Architecture
Build System
(goals) =| hy
a ay
pom.xml
maven :
Local Remote
Repo RepoMaven Build Lifecycle
A Maven build follow a lifecycle
* Default lifecycle
— generate-sources/generate-resources
— compile
— test
— package
— Install
— deploy
* There is also a Clean, Site lifecycleconfiguration file
maven -> goals -> plugins -> task
1. list of source
2. list of resources (plugins/dependencies)
compile:
1.java -> 1.class
2.java -> 2.class
testl.java -> test1.class
test2.java -> test2.class
prod.jar - 1.class+2.class
jar | war | earExample Maven Goals
To invoke a Maven build you set a lifecycle “goal”
mvn install
—"Invokes generate* and compile, test, package, integration-test,
install
mvn clean
— Invokes just clean
mvn clean compile
— Clean old builds and execute generate*, compile
mvn compile install
— Invokes generate*, compile, test, integration-test, package, install
mvn test clean
— Invokes generate*, compile, test then cleansMaven uniquely identifies a project using:
= grouplD: Arbitrary project grouping identifier (no spaces or colons)
* Usually loosely based on Java package
—_ artfiactld; Arbitrary name of project (no spaces or colons)
— version: Version of project
+ Format {Major}.{Minor}.{Maintenance}
* Add “SNAPSHOT ‘ to identify in development
GAY Syntax: groupld:artifactld:version
Build type identified using the “packaging” element
Tells Maven how to build the project
Example packaging types:
— pom, jar, war, ear, custom
— Default is jarMaven Environment Setup
JAVA_HOME
M2_HOME
M2
MAVEN_OPTS = -Xms256m -Xmx512m
PATH=96PATH%; 9%M2%
re archetype:generateMaven Repositories
Dependencies are downloaded from repositories
— Via http
Downloaded dependencies are cached in a local repository
— Usually found in ${user.home}/.m2/repository
Repository follows a simple directory structure
— {groupld}/{artifactid}/{version}/{artifactld}-{version}.jar
— groupld “’ is replaced with ‘/’
Maven Central is primary community repo
— http://repo1.maven.org/maven2valuevalue1.2.3
# What is the plugin
valuevaluevalue I
# When to use the plugin
# What exactly the plugin to do
k/execution>