manen ant svn

24
Apache build projects A practical session on Apache Maven, Ant and Subversion By. S. Suhothayan & Prabath Abaysekara

Upload: sriskandarajah-suhothayan

Post on 27-Jan-2015

120 views

Category:

Economy & Finance


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Manen Ant SVN

Apache build projects A practical session on Apache Maven, Ant and Subversion

By. S. Suhothayan & Prabath Abaysekara

Page 2: Manen Ant SVN

Subversion (SVN)

If more than one developer is working on a project - how can they all make changes to the source code...?

Page 3: Manen Ant SVN

Why version control?

This gives us a history of a software project

If we accidentally delete some code, we can look for an

older version that still has the code

We can see who made what changes

Serves as a backup

Page 4: Manen Ant SVN

Terminology

Repository: a storage location for projects that SVN will manage

Checkout: to download a copy of a project from a repository

Commit: to upload files to a repository after making changes

Update: to download the latest versions of files from a repository when your local copies are out of date

Page 5: Manen Ant SVN

How its done…

More than one developer is working on a

project...

from: OpenMRS

Page 6: Manen Ant SVN

How its done…

more than one developer to works on the same revision

file... and trying to commit at the same time!

from: OpenMRS

Page 7: Manen Ant SVN

How its done…

What if the changes are on the same line !!!

from: OpenMRS

Page 8: Manen Ant SVN

from: OpenMRS

Page 9: Manen Ant SVN

Ant

A software tool for automating software build processes

Similar to MAKE, but:

Written in and developed primarily for Java

Uses XML scripts

Page 10: Manen Ant SVN

How Ant build files written?

Build-scripts are created from existing Ant-tasks.

The Ant tasks do not prescribe any conventions or configuration.

Therefore the definition of project layout is your responsibility.

Advantage

You have full control of whatever you are doing

Disadvantage

Can become a problem in bigger projects.

Page 11: Manen Ant SVN

How to run Ant ?

Can be run from the command line

By default the command line client looks for a build script build.xml in the current directory

> ant

To use a different build script, we have to specify it

> ant -buildfile other.xml

Page 12: Manen Ant SVN

Targets

Build scripts contain targets, the different jobs that they

can performed

We can specify the name of the target to run the specific

target .

> ant compile

Note: If nothing specified will run the default target

Page 13: Manen Ant SVN

Maven

A software project management and comprehension

tool.

Page 14: Manen Ant SVN

What it Maven?

Maven = “Ant With Convention Over Configuration“

Directories

Source, Tests, Resources

Goals

Clean, Test, Deploy, Package, Install, Site...

But... you have to learn the conventions!

Page 15: Manen Ant SVN

Maven Lifecycle validate

Validate the project is correct and all necessary information is available

compile Compile the source code of the project

test Test the compiled source code using a suitable unit testing framework.

package Take the compiled code and package it in its distributable format, such as a JAR.

verify Run any checks to verify the package is valid and meets quality criteria

install Install the package into the local repository, for use as a dependency in other

projects locally

deploy Done in an integration or release environment, copies the final package to the

remote repository for sharing with other developers and projects.

Page 16: Manen Ant SVN

Create a project

With the archetype

mvn archetype:generate \

-DarchetypeGroupId=org.apache.maven.archetypes \

-DgroupId=org.apache.meetup \

-DartifactId=calcualtor-app

Page 17: Manen Ant SVN

Dependencies

Dependencies are uniquely identified by their

Group

Artifact

Version

Declare dependencies in the POM and the Maven will find

it for you!

Page 18: Manen Ant SVN

Dependency management

The real strength!

You only have to declare the dependencies –

maven will download them

setup the classpath and

even deploy the dependencies with your application.

Maven manages not only the direct dependencies - but

even the dependencies of the dependecies (transitive

dependencies)

Page 19: Manen Ant SVN

Maven Repositories

Repositories are used to host dependencies

1.Remote

The servers that hold released binaries

e.g. Artifactory, Nexus

2.Local

~/.m2/repository

Page 20: Manen Ant SVN

Maven Plugins

Reporting

Test Coverage (Sonar)

Javadoc auto-generation

CheckStyle

FindBugs

Ant

Page 21: Manen Ant SVN

Releasing your project

Single command to deploy

Pushing artifact to server

(Almost) Single Command To Release your project!

mvn release:prepare release:perform

Page 22: Manen Ant SVN

Demo

Page 23: Manen Ant SVN

Q & A

Page 24: Manen Ant SVN

Thank You