Introduction to Maven Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to the Java Stack.

Slides:



Advertisements
Similar presentations
Apache Maven: J2EE Front to Back Jesse McConnell -
Advertisements

17 Copyright © 2005, Oracle. All rights reserved. Deploying Applications by Using Java Web Start.
Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.
Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
Build your Android App with Gradle Android new build system.
Functional Testing with the Java Stack Test Runner
Developing CAS in Eclipse
Java Build Tool Comparison HJUG - April 29th, 2009 John Tyler.
Java development infrastructure at FMI Pekka Rantala FMI.
Maven: Build and project management in the 21th century.
Intermediate Maven Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions No making fun of my microphone Prerequisites –
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
APACHE MAVEN Bhavana Sudharshan Jaydeep Patel. Introduction What is Maven? “Maven is a software management and comprehension tool based on the concept.
Chapter 3 Navigating a Project Goals & Objectives 1.Get familiar with the navigation of the project. How is everything structured? What settings can you.
Maven and Stack Starter Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack.
Maven & Bamboo CONTINUOUS INTEGRATION. QA in a large organization In a large organization that manages over 100 applications and over 20 developers, implementing.
AUTOBUILD Build and Deployment Automation Solution.
MAVEN-BLUEMARTINI Yannick Robin. What is maven-bluemartini?  maven-bluemartini is Maven archetypes for Blue Martini projects  Open source project on.
What’s new in Stack 3.2 Michael Youngstrom. Disclaimer This IS a presentation – So sit back and relax Please ask questions.
LDS Account Integration. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in labs Please ask questions Prerequisites:
Demystifying By Mike Desjardins 1. Topics Installation Shock and Awe: Comparison with ant Project Object Model (POM) Inheritance and Modules Dependencies.
Using the ALM Module Fully Automated Deployments in Stack 3.2.
INFSOM-RI Juelich, 10 June 2008 ETICS - Maven From competition, to collaboration.
Using the ALM Module Michael Youngstrom. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in lab Please ask questions.
July 2011CMSC 341 CVS/Ant 1 CMSC 341 Java Packages Ant CVS Project Submission.
LDS Account Integration. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in labs Please ask questions Prerequisites:
1 dec 20, 2007 Maven project automation for dummies Aino Andriessen AMIS.
1 may 31, 2007 Build, test and deploy ADF applications without effort with the use of Maven2 Aino Andriessen AMIS.
Introduction to the Java Stack Michael Youngstrom.
14th Oct 2005CERN AB Controls Development Process of Accelerator Controls Software G.Kruk L.Mestre, V.Paris, S.Oglaza, V. Baggiolini, E.Roux and Application.
Definition (Wikipedia)  What is deployment ? “Software deployment is all of the activities that make a software system available for use.” 1. Install.
Chapter 1 Introducing Ant. What is ant? Ant is a build tool  Automate the tasks of compiling code, running test, and packaging the results for redistribution.
Introduction to Maven 2. Basics Convention over Configuration Declarative project management DRY.
Maven 2.0 Improve your build patterns Vincent Massol CTO Pivolis.
Maven for building Java applications By Nalin De Zoysa
Build Systems Presentation December 14, 2015 Noon-1pm Kathy Lee Simunich Bldg. 203/ D120 Brought to you by: Argonne Java.
Maven 2 The Maven Apache. Overview What's new in Maven 2.0 Maven 2.0 and Ant... and anything else you'd like to know about.
Managing your builds with Maven 2 Craig Walls LoneStar Software Symposium 2007
Software Deployment & Release 26/03/2015 1EN-ICE.
UpgradinguPortal to What’s new that matters Better use of third party frameworks Faster! Improved caching Drag and Drop New Skin & Theme Accessibility.
8/29/10 Maven Repository Management with Nexus Jim McMahon.
Maven. Introduction Using Maven (I) – Installing the Maven plugin for Eclipse – Creating a Maven Project – Building the Project Understanding the POM.
CS520 Web Programming Introduction to Maven Chengyu Sun California State University, Los Angeles.
The Maven Alfresco SDK™ At the end of a journey, there is always a new beginning…
Maven and Jelly James Strachan. Introduction Maven and Jelly are both Apache projects at Jakarta Ultimately both will be top.
Maven & NetBeans Platform. Agenda ● Maven NetBeans Platform Project Types ● Three NetBeans RCP project types ● Differences with Ant project types ● All.
Platform & Maven2 David Šimonek. Certified Engineer Course Agenda What is Maven? Why Maven? NB IDE & Maven NB Platform & Maven.
Agenda:- DevOps Tools Chef Jenkins Puppet Apache Ant Apache Maven Logstash Docker New Relic Gradle Git.
Open-O Integration Project Introduction
Maven 04 March
CS520 Web Programming Introduction to Maven
Build Automation with Gradle
Plan What is Maven ? Links : mvn command line tool
Bhavana Sudharshan Jaydeep Patel
Test Driven Development
prepared by hasan.we4tech.com
Project management and comprehension tool
Chengyu Sun California State University, Los Angeles
Maven IIB9 Plug-in Version 9.0
Mark Dönszelmann Stanford Linear Accelerator Center
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Maven IIB9 Plug-in Version 9.0
Escidoc build and development environment
The Most Popular Android UI Automation Testing Tool Andrii Voitenko
CS4961 Software Design Laboratory Understand Aquila Backend
Build Management EE 461L Based on materials from Christine Julien, Miryung Kim and Adnan Aziz.
Building LabKey with Gradle
Software Engineering and Architecture
Presentation transcript:

Introduction to Maven Michael Youngstrom

Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to the Java Stack – Basic Java and XML skillz

Outline Introduce Maven Basic Maven Pom File and Project Structure Dependencies

Maven Background Is a Java build tool – “project management and comprehension tool” An Apache Project – Mostly sponsored by Sonatype History – Maven 1 (2003) Very Ugly Used in Stack 1 – Maven 2 (2005) Complete rewrite Not backwards Compatible Used in Stack 2.0,2.1,2.2,3.0 – Maven 3 (2010) Same as Maven 2 but more stable Used in Stack 2.3, 3.1

Maven Features Dependency System Multi-module builds Consistent project structure Consistent build model Plugin oriented Project generated sites

The Maven Mindset All build systems are essentially the same: – Compile Source code – Copy Resource – Compile and Run Tests – Package Project – Deploy Project – Cleanup Describe the project and configure the build – You don’t script a build – Maven has no concept of a condition – Plugins are configured

Other Java Build Tools Ant (2000) – Granddaddy of Java Build Tools – Scripting in XML – Very flexible Ant+Ivy (2004) – Ant but with Dependency Management Gradle (2008) – Attempt to combine Maven structure with Groovy Scripting – Easily extensible – Immature

Maven Learning Resources Maven Homepage – Reference Documentation for Maven Reference Documentation for core Plugins Sonatype Resources – Free Books Videos

Lab 1: Learning Resources Lab_1_Learning_Resources

Maven POM Stands for Project Object Model Describes a project – Name and Version – Artifact Type – Source Code Locations – Dependencies – Plugins – Profiles (Alternate build configurations) Uses XML by Default – Not the way Ant uses XML

Project Name (GAV) Maven uniquely identifies a project using: – groupID: Arbitrary project grouping identifier (no spaces or colons) Usually loosely based on Java package – artfiactId: Arbitrary name of project (no spaces or colons) – version: Version of project Format {Major}.{Minor}.{Maintanence} Add ‘-SNAPSHOT ‘ to identify in development GAV Syntax: groupId:artifactId:version org.lds.training maven-training 1.0

Packaging Build type identified using the “packaging” element Tells Maven how to build the project Example packaging types: – pom, jar, war, ear, custom – Default is jar maven-training org.lds.training 1.0 jar

Project Inheritance Pom files can inherit configuration – groupId, version – Project Config – Dependencies – Plugin configuration – Etc. maven-training-parent org.lds.training maven-training jar

Multi Module Projects Maven has 1 st class multi-module support Each maven project creates 1 primary artifact A parent pom is used to group modules... pom maven-training maven-training-web

Maven Conventions Maven is opinionated about project structure target: Default work directory src: All project source files go in this directory src/main: All sources that go into primary artifact src/test: All sources contributing to testing project src/main/java: All java source files src/main/webapp: All web source files src/main/resources: All non compiled source files src/test/java: All java test source files src/test/resources: All non compiled test source files

Maven Build Lifecycle A Maven build follow a lifecycle Default lifecycle – generate-sources/generate-resources – compile – test – package – integration-test (pre and post) – Install – deploy There is also a Clean lifecycle

Example 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 cleans

Lab 2: Create a Maven Project Lab_2_Create_a_Maven_Project

Maven and Dependencies Maven revolutionized Java dependency management – No more checking libraries into version control Introduced the Maven Repository concept – Established Maven Central Created a module metadata file (POM) Introduced concept of transitive dependency Often include source and javadoc artifacts

Adding a Dependency Dependencies consist of: – GAV – Scope: compile, test, provided (default=compile) – Type: jar, pom, war, ear, zip (default=jar)... javax.servlet servlet-api 2.5 provided

Maven 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 – {groupId}/{artifactId}/{version}/{artifactId}-{version}.jar – groupId ‘.’ is replaced with ‘/’ Maven Central is primary community repo –

Proxy Repositories Proxy Repositories are useful: – Organizationally cache artifacts – Allow organization some control over dependencies – Combines repositories ICS uses the Nexus repository manager All artifacts in Nexus go through approval process – License verified – Improve organizational reuse To request approval create issue in SDS jira project: –

Defining a repository Repositories are defined in the pom Repositories can be inherited from parent Repositories are keyed by id Downloading snapshots can be controlled... lds-main LDS Main Repo false

Transitive Dependencies Transitive Dependency Definition: – A dependency that should be included when declaring project itself is a dependency ProjectA depends on ProjectB If ProjectC depends on ProjectA then ProjectB is automatically included Only compile and runtime scopes are transitive Transitive dependencies are controlled using: – Exclusions – Optional declarations

Dependency Exclusions Exclusions exclude transitive dependencies Dependency consumer solution... org.springframework spring-core RELEASE commons-logging

Optional Dependencies Don’t propagate dependency transitively Dependency producer solution Optional is under used... org.springframework spring-core RELEASE true

Dependency Management What do you do when versions collide? – Allow Maven to manage it? Complex and less predictable – Take control yourself Manage the version manually In Java you cannot use both versions... org.springframework spring-core RELEASE

Using Dependency Management Other uses for Dependency Management – Allowing parent pom to manage versions – Unify exclusions... org.springframework spring-core RELEASE org.springframework spring-core

Lab 3: Manage Maven Dependencies Lab_3_Manage_Maven_Dependencies

Summary Maven is a different kind of build tool It is easy to create multi-module builds Dependencies are awesome