没有合适的资源?快使用搜索试试~ 我知道了~
首页maven-definitive-guide.pdf
maven-definitive-guide.pdf
5星 · 超过95%的资源 需积分: 11 15 下载量 44 浏览量
更新于2023-03-03
评论
收藏 5.11MB PDF 举报
maven-definitive-guide.pdf maven-definitive-guide.pdf maven-definitive-guide.pdf maven-definitive-guide.pdf
资源详情
资源评论
资源推荐
Tim O'Brien (Sonatype, Inc.), John Casey (Sonatype, Inc.), Brian Fox (Sonatype, Inc.), Bruce
Snyder (Sonatype, Inc.), Jason Van Zyl (Sonatype, Inc.), Eric Redmond ()
Copyright © 2006-2008
Copyright .......................................................................................................xii
1. Creative Commons BY-ND-NC .........................................................xii
Foreword: 0.22.0 ...........................................................................................xiv
Preface ...........................................................................................................xvi
1. How to Use this Book ........................................................................xvi
2. Your Feedback ..................................................................................xvii
3. Font Conventions .............................................................................xviii
4. Maven Writing Conventions ............................................................xviii
5. Acknowledgements ............................................................................xix
1. Introducing Apache Maven .......................................................................... 1
1.1. Maven... What is it? ...........................................................................1
1.2. Convention Over Configuration ......................................................... 2
1.3. A Common Interface ..........................................................................3
1.4. Universal Reuse through Maven Plugins ...........................................4
1.5. Conceptual Model of a "Project" .......................................................5
1.6. Is Maven an alternative to XYZ? ....................................................... 6
1.7. Comparing Maven with Ant ..............................................................8
1.8. Summary ..........................................................................................12
2. Installing and Running Maven ...................................................................13
2.1. Verify your Java Installation ............................................................13
2.2. Downloading Maven ........................................................................14
2.3. Installing Maven ..............................................................................14
2.3.1. Installing Maven on Mac OSX .............................................. 14
2.3.2. Installing Maven on Microsoft Windows .............................. 16
2.3.3. Installing Maven on Linux .....................................................16
2.3.4. Installing Maven on FreeBSD or OpenBSD .......................... 16
2.4. Testing a Maven Installation ............................................................17
2.5. Maven Installation Details ...............................................................17
2.5.1. User-specific Configuration and Repository .......................... 18
2.5.2. Upgrading a Maven Installation ............................................. 19
2.5.3. Upgrading from Maven 1.x to Maven 2.x ..............................20
2.6. Uninstalling Maven ..........................................................................21
2.7. Getting Help with Maven .................................................................21
ii
2.8. Using the Maven Help Plugin .......................................................... 22
2.8.1. Describing a Maven Plugin .................................................... 23
2.9. About the Apache Software License ................................................25
I. Maven by Example .....................................................................................28
3. A Simple Maven Project .....................................................................30
3.1. Introduction ...............................................................................30
3.1.1. Downloading this Chapter's Example ............................. 30
3.2. Creating a Simple Project .......................................................... 31
3.3. Building a Simple Project ......................................................... 33
3.4. Simple Project Object Model ....................................................34
3.5. Core Concepts ........................................................................... 35
3.5.1. Maven Plugins and Goals ................................................ 36
3.5.2. Maven Lifecycle .............................................................. 38
3.5.3. Maven Coordinates ......................................................... 42
3.5.4. Maven Repositories ......................................................... 45
3.5.5. Maven's Dependency Management ................................. 47
3.5.6. Site Generation and Reporting ........................................ 50
3.6. Summary ................................................................................... 51
4. Customizing a Maven Project .............................................................52
4.1. Introduction ...............................................................................52
4.1.1. Downloading this Chapter's Example ............................. 52
4.2. Defining the Simple Weather Project ....................................... 52
4.2.1. Yahoo! Weather RSS ...................................................... 53
4.3. Creating the Simple Weather Project ........................................ 53
4.4. Customize Project Information ................................................. 55
4.5. Add New Dependencies ............................................................56
4.6. Simple Weather Source Code ...................................................58
4.7. Add Resources .......................................................................... 64
4.8. Running the Simple Weather Program ..................................... 66
4.8.1. The Maven Exec Plugin .................................................. 67
4.8.2. Exploring Your Project Dependencies ............................ 68
4.9. Writing Unit Tests ..................................................................... 70
4.10. Adding Test-scoped Dependencies ......................................... 73
4.11. Adding Unit Test Resources ................................................... 74
Maven: The Definitive Guide
iii
4.12. Executing Unit Tests ...............................................................76
4.12.1. Ignoring Test Failures ................................................... 77
4.12.2. Skipping Unit Tests ....................................................... 78
4.13. Building a Packaged Command Line Application .................. 79
4.13.1. Attaching the Assembly Goal to the Package Phase ..... 81
5. A Simple Web Application ................................................................. 83
5.1. Introduction ...............................................................................83
5.1.1. Downloading this Chapter's Example ............................. 83
5.2. Defining the Simple Web Application ...................................... 83
5.3. Creating the Simple Web Project .............................................. 84
5.4. Configuring the Jetty Plugin ..................................................... 85
5.5. Adding a Simple Servlet ........................................................... 87
5.6. Adding J2EE Dependencies ...................................................... 90
5.7. Conclusion ................................................................................. 91
6. A Multi-module Project ......................................................................92
6.1. Introduction ...............................................................................92
6.1.1. Downloading this Chapter's Example ............................. 92
6.2. The Simple Parent Project ......................................................... 92
6.3. The Simple Weather Module .................................................... 94
6.4. The Simple Web Application Module ...................................... 97
6.5. Building the Multimodule Project ............................................. 99
6.6. Running the Web Application ................................................. 101
7. Multi-module Enterprise Project .......................................................102
7.1. Introduction .............................................................................102
7.1.1. Downloading this Chapter's Example ........................... 102
7.1.2. Multi-module Enterprise Project ................................... 103
7.1.3. Technology Used in this Example ................................ 106
7.2. The Simple Parent Project ....................................................... 107
7.3. The Simple Model Module ..................................................... 108
7.4. The Simple Weather Module .................................................. 113
7.5. The Simple Persist Module ..................................................... 118
7.6. The Simple Web Application Module .................................... 126
7.7. Running the Web Application ................................................. 138
7.8. The Simple Command Module ............................................... 139
Maven: The Definitive Guide
iv
7.9. Running the Simple Command ............................................... 146
7.10. Conclusion ............................................................................. 149
7.10.1. Programming to Interface Projects .............................. 150
8. Optimizing and Refactoring POMs ................................................... 152
8.1. Introduction .............................................................................152
8.2. POM Cleanup .......................................................................... 153
8.3. Optimizing Dependencies ....................................................... 153
8.4. Optimizing Plugins .................................................................. 159
8.5. Optimizing with the Maven Dependency Plugin ....................160
8.6. Final POMs ............................................................................. 164
8.7. Conclusion ............................................................................... 173
II. Maven Reference ..................................................................................... 174
9. The Project Object Model .................................................................175
9.1. Introduction .............................................................................175
9.2. The POM ................................................................................. 175
9.2.1. The Super POM ............................................................. 178
9.2.2. The Simplest POM ........................................................ 182
9.2.3. The Effective POM ....................................................... 183
9.2.4. Real POMs .................................................................... 183
9.3. POM Syntax ............................................................................184
9.3.1. Project Versions ............................................................ 184
9.3.2. Property References ...................................................... 187
9.4. Project Dependencies ..............................................................189
9.4.1. Dependency Scope ........................................................ 190
9.4.2. Optional Dependencies ................................................. 192
9.4.3. Dependency Version Ranges ........................................193
9.4.4. Transitive Dependencies ............................................... 195
9.4.5. Conflict Resolution ....................................................... 197
9.4.6. Dependency Management ............................................. 199
9.5. Project Relationships ............................................................... 201
9.5.1. More on Coordinates ..................................................... 202
9.5.2. Multi-module Projects ................................................... 203
9.5.3. Project Inheritance ......................................................... 205
9.6. POM Best Practices ................................................................. 208
Maven: The Definitive Guide
v
剩余522页未读,继续阅读
pister
- 粉丝: 4
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1