ImageVerifierCode 换一换
格式:DOCX , 页数:12 ,大小:21.42KB ,
资源ID:20400636      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/20400636.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(深入理解maven及应用Word格式.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

深入理解maven及应用Word格式.docx

1、copy and process the resources into the destination directory, ready for pilecompile the source code of the project.process-classespost-process the generated files from compilation, for example to do bytecode enhancement on Java classes.generate-test-sourcesgenerate any test source code for inclusio

2、n in compilation.process-test-sourcesprocess the test source code, for example to filter any values.generate-test-resourcescreate resources for testing.process-test-resourcescopy and process the resources into the test destination directory.test-compilecompile the test source code into the test dest

3、ination directoryprocess-test-classespost-process the generated files from test compilation, for example to do bytecode enhancement on Java classes. For Maven 2.0.5 and above.testrun tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed.prepar

4、e-packageperform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package. (Maven 2.1 and above)packagetake the compiled code and package it in its distributable format, such as a JAR.pre-integration-testperform ac

5、tions required before integration tests are executed. This may involve things such as setting up the required environment.integration-testprocess and deploy the package if necessary into an environment where integration tests can be run.post-integration-testperform actions required after integration

6、 tests have been executed. This may including cleaning up the environment.verifyrun any checks to verify the package is valid and meets quality criteria.installinstall the package into the local repository, for use as a dependency in other projects locally.deploydone in an integration or release env

7、ironment, copies the final package to the remote repository for sharing with other developers and projects.4、site生命周期 siet生命周期的目的是建立和发布项目站点,maven能够基于POM所包含的信息,自动生成一个友好的站点,方便团队交流和发布项目信息,包含的阶段如下:pre-siteexecutes processes needed prior to the actual project site generationsitegenerates the projects sit

8、e documentationpost-siteexecutes processes needed to finalize the site generation, and to prepare for site deploymentsite-deploydeploys the generated site documentation to the specified web server5、命令行与生命周期从命令行执行maven任务的最主要方式就是调用maven的生命周期阶段。需要注意的是,各个生命周期是相互独立的,而一个生命周期的阶段是有前后依赖关系的。例子如下: 1、$mvn clean

9、 :该命令调用clean生命周期的clean阶段。实际执行的阶段为clean生命周期的pre-clean和clean阶段。 2、$mvn test:该命令调用default生命周期的test阶段。实际调用的是default生命周期的validate、initialize等,直到test的所有阶段。 3、$mvn clean install:该命令调换用clean生命周期的clean阶段和default生命周期的instal阶段。6、插件目标 maven的核心仅仅定义了抽象的生命周期,具体的任务是交由插件完成的,插件以独立的形式存在。 对于插件本身,为了能够复用代码,它往往能够完成多个任务。如m

10、aven-dependency-plugin有十多个目标,每个目标对应了一个功能,如 dependency:analyze、 dependency:tree和dependency:list。这是一种通用的写法,冒号前面是插件前缀,后面是该插件的目标。7、插件绑定maven的生命周期与插件相互绑定,用以完成实际的构建任务。具体而言,是生命周期的阶段与插件的目标相互绑定,已完成某个具体的构建任务。例如项目编译这一任务,它对应了default生命周期的compile阶段,而maven-compiler-plugin这一插件的compile目标能够完成该任务,因此将他们绑定。7.1内置绑定maven在

11、核心为一些主要的生命周期接到绑定了很多插件的目标,如下: clean和site生命周期相对简单。clean:site: default生命周期与插件目标的绑定关系有点复杂一些。这是因为对于任何项目来说,例如jar项目和war项目,他们的项目清理和站点生成任务是一样的,不过构建过程会有区别。例如jar项目需要打成jar包,而war项目需要打成war包。由于项目的打包类型会影响构建的具体过程,因此,default生命周期的阶段与插件目标的绑定关系有项目打包类型所决定的,打包类型是通过pom中的packaging元素定义的。最常见的打包类型是jar,它也是默认的打包类型。基于该打包类型,defaul

12、t生命周期的内置绑定关系如下:resources:resourcescompiler:testResourcestestCompilesurefire:ejb:ejborejb3:ejb3jar:jarpar:parrar:rarwar:warinstall:deploy:7、2自定义绑定 除了内置绑定以为,用户还能够自己选择奖某个插件目标绑定到生命周期的某个阶段以执行更多更特色的任务。htmlview plaincopyprint? 1. 2. 3. groupIdorg.apache.maven.plugins4. artifactIdmaven-resources-plugin5. ve

13、rsion2.66. configuration7. includeEmptyDirstrue8. encodingGBK9. nonFilteredFileExtensions10. nonFilteredFileExtensionexe11. zip12. vbs13. sh15. /configuration16. executions17. execution18. idcopy-resources19. phasevalidate20. goals21. goal/goal22. /goals23. 24. 25. outputDirectory$project.build.dire

14、ctory26. excludes27. excludeagentmanager.jsmooth28. assembly.xml30. resources31. resource32. directorysrc/main/resources/33. filtering/filtering34. /resource35. /resources36. 37. /execution38. /executions39. /plugin 如上图定义了一个id为copy-resources的任务,绑定到default生命周期的validate阶段,绑定的插件为maven-resources-plugin,

15、插件目标为copy-resources。即用插件的copy-resources功能来实现项目资源文件的拷贝。自动复制maven依赖包到lib目录maven-dependency-plugin2.1copyinstallcopy-dependencieslib同上,定义了一个id为copy的任务,利用插件maven-dependency-plugin的copy-dependencies目标绑定到default生命周期的install阶段,来实现项目依赖的jar包的自动复制。当插件目标被绑定到不同的生命周期阶段时候,其执行顺序会有生命周期阶段的先后顺序决定的。如果多个目标被绑定到同一个阶段,他们的

16、执行顺序是由插件声明的先后顺序决定目标的执行顺序。8、插件配置用户可以配置插件目标的参数,进一步调整插件目标所执行的任务。8、1命令行插件配置如 $mvn install -Dmaven.test.skip=true 的意义即跳过测试步骤。 参数-D的java自带的,其功能是通过命令行设置一个java系统属性,maven简单地重用了该参数以实现插件参数的配置。8、2pom中插件全局配置如项目编译使用1.6版本的源文件,生成与JVM1.6兼容的字节码文件,如下:maven-compiler-plugin2.3.21.6target/target9、获取插件描述信息 $mvn help:descr

17、ibe-Dplugin=org.apache.maven.plugins:maven-compiler-plugin:2.1 来获取插件的详细信息 可以简化为:describe-Dplugin=compiler 如果仅仅描述插件目标的信息,可以加上goal参数:describe-Dplugin=compiler-Dgoal=compile 如果想输出更详细的信息,可以加上detail参数:describe-Dplugin=compiler-Ddetail(二):灵活的构建原文地址:参考官方url:http:/maven.apache.org/guides/index.html一个优秀的构建系统必须足够灵活,应该能够让项目在不同的环境下都能成功构建。maven为了支持构建的灵活性,内置了三大特性,即:属性、profile和资源过滤。1、maven属性maven属性分6类: 1、内置属性:如$basedir表示项目根目录,$version表示项目版本 2、POM属性:用户可以引用pom文件中对应的值。如: $basedir 项目根目录$project.build.directory 构建目录,缺省为target$project.build.outputDirectory 构建过程输出目录,缺省为target/classes$project.build.finalNam

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1