Juggling Java EE with Enterprise Apache Maven Jesse McConnell -

Slides:



Advertisements
Similar presentations
Vincent Massol, 1 st December 2006 Quality with Maven2.
Advertisements

Apache Maven: J2EE Front to Back Jesse McConnell -
Question examples. Session 1 Objectives Why certify? Positioning of the non-technical version What is Java? Key advantages of Java Java Applications vs.
JSP and web applications
Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.
OpusCollege and Spring-DM. OSGi based web applications – three strategies OSGi container embedded in another container: OSGi Bridge Server (OBS)  e.g.
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.
Introduction to Maven Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to the Java Stack.
Developing CAS in Eclipse
My First Building Block Presented By Tracy Engwirda 28 September, 2005.
Sapana Mehta (CS 6V81) Instructions for using Jboss User Manual.
1 Dive into Apache Geronimo 3.0 Xu Haihong Apache Geronimo PMC
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Building and Deploying a Simple Web Application. Tomcat and JSP Tomcat is an application server, commonly used to host JSP applications Applications are.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Open source administration software for education research administration Lin-Long Shyu System Analyst Kuali Coeus Technical Team Indiana University
Enterprise Java v090401JavaEE EAR1 Java EE Enterprise Archive (EAR)
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
Maven and Stack Starter Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack.
© Blackboard, Inc. All rights reserved. My First Building Block as a Content Type Heather Natour Senior Lead Engineer Blackboard Inc. July 18 th 1:30pm.
Maven & Bamboo CONTINUOUS INTEGRATION. QA in a large organization In a large organization that manages over 100 applications and over 20 developers, implementing.
MAVEN-BLUEMARTINI Yannick Robin. What is maven-bluemartini?  maven-bluemartini is Maven archetypes for Blue Martini projects  Open source project on.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
LDS Account Integration. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in labs Please ask questions Prerequisites:
Developing Axis based Web Services using Eclipse 3.3 Saurabh Mittal Feb 28, 2008.
Introduction to J2EE Architecture Portions by Kunal Mehta.
JBoss at Work JAW Motors Application Chapter 1-3 Jeff Schmitt October 9, 2006.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
Using the ALM Module Fully Automated Deployments in Stack 3.2.
Web Applications - Basics. Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server.
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.
Enterprise Development with IntelliJ IDEA Mike Aizatsky Project Manager JetBrains, Inc.
Ch 2 – Application Assembly and Deployment COSC 617 Jeff Schmitt September 14, 2006.
1 Apache TomEE // JavaEE Web Profile on Tomcat Jonathan #TomEE.
C HAPTER 11 D EPLOYING YOUR WEB APP. WAR FILE A WAR file is simply a snapshot of your web app structure, in a nice portable, compressed form (it is really.
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.
Maven 2.0 Improve your build patterns Vincent Massol CTO Pivolis.
Maven for building Java applications By Nalin De Zoysa
Fall CIS 764 Database Systems Engineering L15: Deployment Deploy … to place or arrange for deliberate (intended) purpose.
Build Systems Presentation December 14, 2015 Noon-1pm Kathy Lee Simunich Bldg. 203/ D120 Brought to you by: Argonne Java.
Managing your builds with Maven 2 Craig Walls LoneStar Software Symposium 2007
Software Deployment & Release 26/03/2015 1EN-ICE.
OpenMRS Create New Module.
CS520 Web Programming Bits and Pieces of Web Programming (II) Chengyu Sun California State University, Los Angeles.
Maven. Introduction Using Maven (I) – Installing the Maven plugin for Eclipse – Creating a Maven Project – Building the Project Understanding the POM.
From Venus to Mars Developer land Real world Maven Alfresco SDK is fun! -Pamp-to-war Alfresco AMP Archetype Share AMP Archetype.
CS520 Web Programming Introduction to Maven Chengyu Sun California State University, Los Angeles.
Exploring Maven 2 Craig Walls Gateway Software Symposium 2007 Blog: Wiki: Examples:
Apache Geronimo Open Source J2EE Application Server Getting up to speed with Apache Geronimo - Copyright 2005 Tom McQueeney 1 Getting up to speed with.
Maven & NetBeans Platform. Agenda ● Maven NetBeans Platform Project Types ● Three NetBeans RCP project types ● Differences with Ant project types ● All.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
Platform & Maven2 David Šimonek. Certified Engineer Course Agenda What is Maven? Why Maven? NB IDE & Maven NB Platform & Maven.
Maven 04 March
CS520 Web Programming Introduction to Maven
Plan What is Maven ? Links : mvn command line tool
Bhavana Sudharshan Jaydeep Patel
Writing simple Java Web Services using Eclipse
Test Driven Development
prepared by hasan.we4tech.com
Maven IIB9 Plug-in Version 9.0
J2EE Application Development
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Maven IIB9 Plug-in Version 9.0
Escidoc build and development environment
Presentation transcript:

Juggling Java EE with Enterprise Apache Maven Jesse McConnell -

Who Am I? On Maven PMC Active in Continuum Some maven plugins Some mojo codehaus –axistools-maven-plugin - don’t hold that against me…pls codehaus

Is this you?

Java EE Application Development by Convention No laughing matter People cry everyday because of java ee Maven can help keep crying to a minimum –hopefully –Planning is key

Components of Java EE Enterprise Java Beans’s –maven-ejb-plugin V. 2 and 3 specs Web Services –axistools-maven-plugin –cxf-maven-plugin –others Web Archives (Wars) –maven-war-plugin Enterprise Archives (Ears) –maven-ear-plugin

You should end up with…

Maven Lifecycle Supported since the beginning with maven 2 Java EE artifact linkage is managed through dependencies Artifact construction dictated by

Understanding Structure in Maven Follow Conventions Archiva and Continuum are good example Web Applications Redback is security overlay packaged as a Web Application and overlaid

Library Code Understanding the final goal and scoping dependencies appropriately. That means…understand Java EE classloaders Understand your Container –Like to think they are all interchangeable –Can be harder in practice

EJB Structure and Management ejb Directory Layout |-- pom.xml `-- src `-- main `-- resources `-- META-INF `-- ejb-jar.xml

EJB Structure and Management Plugin Example maven-ejb-plugin true

Linking into Build Validates ejb-jar.xml file existence Unless you specify ejbVersion 3.0

Testing EJB Code Best bet is testing modularly like with normal junit testing. Otherwise test when in ear and under typical ejb conditions

Web Service Structures and Management No strict lifecycle phase No strict directory layout Depends on web service architecture in use xfire -> CXF, Axis, etc Code generation components –wsdl2java –java2wsdl

Linking into Build Consider services, clients, resource libraries Common project layout Annotations of services –All kind of implementation specific –Real deal is testing them

Testing Web Services Can be hard to test directly Client testing against established servers begs irreproducibility Test by deploying services to embedded jetty and running client code

War Structure and Management war Directory Layout |-- pom.xml `-- src `-- main |-- java | `-- com | `-- example | `-- projects | `-- SampleAction.java |-- resources | |-- images | | `-- sampleimage.jpg | `-- sampleresource `-- webapp |-- WEB-INF | `-- web.xml |-- index.jsp `-- jsp `-- websource.jsp

War Structure and Management Plugin Example org.apache.maven.plugins maven-war-plugin 2.0 /container/deploy/dir

War Overlay Often handy to build component oriented wars. Overlay multiple war files to create actual war file. –Continuum and Archiva do this is redback for shared security and user management bits

Linking into Build Dependency management scoping is key Dig into your war file and see what is in there –Don’t be afraid, its doesn’t bite provided can be your friend Other Options: – WEB-INF/lib/*.jar

Three different usages War:war - standard war creation War:exploded - builds out war in exploded format in target dir War:inplace - builds out webapp in src/main/webapp Dependency Management scoping key for war usability

War Overlay I - Clean org.apache.maven.plugins maven-clean-plugin ${basedir}/src/main/webapp images/redback template/ template/redback WEB-INF/classes WEB-INF/lib

War Overlay II - War org.apache.maven.plugins maven-war-plugin false META-INF/**,WEB-INF/web.xml,WEB-INF/classes/xwork.xml,WEB-INF/lib/** compile inplace

Jetty Configuration org.mortbay.jetty maven-jetty-plugin / ${basedir}/src/jetty-env.xml org.apache.derby derby appserver.base ${project.build.directory}/appserver-base appserver.home ${project.build.directory}/appserver-home derby.system.home ${project.build.directory}/appserver-base/logs

Testing Wars I jetty-maven-plugin for ‘click testing’ –mvn jetty:run Integration testing a bit more involved…

TestingWars II generate-resources –dependency-maven-plugin Unzip the webapp Prepare provided dependencies package –maven-antrun-plugin Copy container configuration Copy provided dependencies pre-integration-test –selenium-maven-plugin Start server –cargo-maven2-plugin Start container integration-test –maven-antrun-plugin Check continuum started –maven-surefire-plugin Run tests Post-integration-test –Cargo-maven2-plugin Stop container

Scoping War Dependencies Two Approaches, different scoping –Deploying Wars –Integrating into Ears

Ear Structure and Management Directory Layout –No specific directories required –Dependencies are key to ear files Automatic application.xml creation MANIFEST.MF Creation

Ear Structure and Management Plugin Example maven-ear-plugin true

Linking into Build Just do it… Then triage. Primary recommendation, keep your project modular Test your modules Use ear module as simply the aggregation of the project packaging

Supported Ear Modules ejb3Module - ejb3 (Enterprise Java Bean version 3) ejbClientModule - ejb-client (Enterprise Java Bean Client) ejbModule - ejb (Enterprise Java Bean) jarModule - jar (Java Archive) harModule - har (Hibernate Archive) parModule - par (Plexus Archive) rarModule - rar (Resource Adapter Archive) sarModule - sar (JBoss Service Archive) webModule - war (Web Application Archive) wsrModule - wsr (JBoss Web Service Archive)

Testing Ears Functionally the same kind of process as the war integration testing use cargo –Bind start app server to pre-integration-test phase –Start Selenium server –Run any surefire tests –Bind stop app server to post-integration-test

Scoping Ear Dependencies Learn Dependency Management in parent poms –Love it Plan for ear deployment, scope things that are used by multiple war and ejb’s as provided or test in those poms Scope for inclusion in ear, leave versioning to the dependencyManagement, its why it is there

Application Deployment Options Cargo - cargo.codehaus.org –Supported containers Geronimo 1.x - geronimo1x JBoss 3.x, 4.x - jboss3x, jboss4x Jetty 4.x, 5.x, 6.x - jetty4x, jetty5x, jetty6x jo! 1.x - jo1x OC4J 9.x - oc4j9x Orion 1.x, 2.x - orion1x, orion2x Resin 2.x, 3.x - resin2x, resin3x Tomcat 3.x, 4.x, 5.x - tomcat3x, tomcat4x, tomcat5x WebLogic 8.x - weblogic8x –Maven2 plugin support Deployment area largely untargeted by maven conventions Hard to standardize in real world

Tips and Tricks Got a 300meg ear file? –Check the scoping –Pull apart the artifacts and look for jar duplication –Understand Java EE classloaders

Tips and Tricks II maven-ejb-plugin 3.0 ${server.type} prod jdbc:odbc:prod;UID=prod;PWD=p4ssw0rd prod test jdbc:odbc:test;UID=test;PWD=p4ssw0rd test dev jdbc:derby:dev dev

Using Archetypes maven-archetype-j2ee-simple –Sample aggregate project Geronimo sample archetypes Many jetty sample archetypes –

Questions? Jesse McConnell - Resources –Better Builds with Maven –Maven: The Definitive Guide