Juggling Java EE with Enterprise Apache Maven

上传人:飞*** 文档编号:48801923 上传时间:2018-07-20 格式:PPT 页数:38 大小:1.83MB
返回 下载 相关 举报
Juggling Java EE with Enterprise Apache Maven_第1页
第1页 / 共38页
Juggling Java EE with Enterprise Apache Maven_第2页
第2页 / 共38页
Juggling Java EE with Enterprise Apache Maven_第3页
第3页 / 共38页
Juggling Java EE with Enterprise Apache Maven_第4页
第4页 / 共38页
Juggling Java EE with Enterprise Apache Maven_第5页
第5页 / 共38页
点击查看更多>>
资源描述

《Juggling Java EE with Enterprise Apache Maven》由会员分享,可在线阅读,更多相关《Juggling Java EE with Enterprise Apache Maven(38页珍藏版)》请在金锄头文库上搜索。

1、Juggling Java EE with Enterprise Apache MavenJesse McConnell - jmcconnellapache.orgWho Am I? On Maven PMC Active in Continuum Some maven plugins Some mojo plugins codehaus axistools-maven-plugin - dont hold that against mepls Redback codehausIs this you?Java EE Application Development by Convention

2、No laughing matter People cry everyday because of java ee Maven can help keep crying to a minimum hopefully Planning is keyComponents of Java EEEnterprise Java Beanss maven-ejb-plugin V. 2 and 3 specs Web Services axistools-maven-plugin cxf-maven-plugin others Web Archives (Wars) maven-war-plugin En

3、terprise Archives (Ears) maven-ear-pluginYou should end up withMaven 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 exam

4、ple Web Applications Redback is security overlay packaged as a Web Application and overlaidLibrary Code Understanding the final goal and scoping dependencies appropriately. That meansunderstand Java EE classloaders Understand your Container Like to think they are all interchangeable Can be harder in

5、 practiceEJB Structure and Management ejb Directory Layout |- pom.xml - src- main- resources- META-INF- ejb-jar.xmlEJB Structure and Management Plugin Examplemaven-ejb-plugintrueLinking into Build Validates ejb-jar.xml file existence Unless you specify ejbVersion 3.0Testing EJB Code Best bet is test

6、ing modularly like with normal junit testing. Otherwise test when in ear and under typical ejb conditionsWeb 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 j

7、ava2wsdlLinking into Build Consider services, clients, resource libraries Common project layout Annotations of services All kind of implementation specific Real deal is testing themTesting Web Services Can be hard to test directly Client testing against established servers begs irreproducibility Tes

8、t by deploying services to embedded jetty and running client codeWar Structure and Managementwar Directory Layout |- pom.xml- src- main|- java| - com| - example| - projects| - SampleAction.java|- resources| |- images| | - sampleimage.jpg| - sampleresource- webapp|- WEB-INF| - web.xml|- index.jsp- js

9、p- websource.jspWar Structure and ManagementPlugin Exampleorg.apache.maven.pluginsmaven-war-plugin2.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

10、user management bitsLinking into Build Dependency management scoping is key Dig into your war file and see what is in there Dont be afraid, its doesnt bite provided can be your friend Other Options: WEB-INF/lib/*.jarThree different usages War:war - standard war creation War:exploded - builds out war

11、 in exploded format in target dir War:inplace - builds out webapp in src/main/webapp Dependency Management scoping key for war usabilityWar Overlay I - Cleanorg.apache.maven.pluginsmaven-clean-plugin2.1.1$basedir/src/main/webappimages/redbacktemplate/template/redbackWEB-INF/classesWEB-INF/libWar Ove

12、rlay II - Warorg.apache.maven.pluginsmaven-war-plugin2.0.1falseMETA-INF/*,WEB-INF/web.xml,WEB-INF/classes/xwork.xml,WEB-INF/lib/*compileinplaceJetty Configurationorg.mortbay.jettymaven-jetty-plugin6.1.010/$basedir/src/jetty-env.xml909060000org.apache.derbyderby10.1.3.1appserver.base$project.build.di

13、rectory/appserver-baseappserver.home$project.build.directory/appserver-homederby.system.home$project.build.directory/appserver-base/logsTesting Wars I jetty-maven-plugin for click testing mvn jetty:run Integration testing a bit more involvedTestingWars IIgenerate-resources dependency-maven-plugin Un

14、zip 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-plu

15、gin Run tests Post-integration-test Cargo-maven2-plugin Stop containerScoping War Dependencies Two Approaches, different scoping Deploying Wars Integrating into EarsEar Structure and Management Directory Layout No specific directories required Dependencies are key to ear files Automatic application.xml creation MANIFEST.MF CreationEar Structure and ManagementPlugin Examplemaven-ear-plugintrueLinking into Build Just do it Then triage. Primary recommendation, keep your project modular Test you

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号