1 / 13

Maven2 Study

Maven2 Study. Aries Zhao. Catalog. What is Maven Getting Start Maven Introduction How to Use Maven Maven with Eclipse How to Build J2EE Project. What is Maven ( 1 ). Maven 是标准、存储格式以及一些软件用以管理和描述项目。 它为构建、测试、部署项目定义了一个标准的生命周期。 它提供了一个框架 , 允许遵循 Maven 标准的所有项目 , 方便的重用公用的构建逻辑 Maven3 …….

oihane
Download Presentation

Maven2 Study

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Maven2 Study Aries Zhao

  2. Catalog • What is Maven • Getting Start • Maven Introduction • How to Use Maven • Maven with Eclipse • How to Build J2EE Project

  3. What is Maven(1) • Maven是标准、存储格式以及一些软件用以管理和描述项目。 • 它为构建、测试、部署项目定义了一个标准的生命周期。 • 它提供了一个框架,允许遵循Maven标准的所有项目,方便的重用公用的构建逻辑 • Maven3 • ……

  4. What is Maven(2) • Maven是标准、存储格式以及一些软件用以管理和描述项目。 • 它为构建、测试、部署项目定义了一个标准的生命周期。 • 它提供了一个框架,允许遵循Maven标准的所有项目,方便的重用公用的构建逻辑 • Maven3 • ……

  5. GettingStart(1) • Download http://maven.apache.org/download.html • Installation(Windows) 解压apache-maven-2.2.1-bin.zip至C:\ M2_HOME=C:\software\maven-2.2.1 PATH中中添加%M2_HOME%\bin • Validation 运行:mvn -version

  6. GettingStart(2) • mvnarchetype:create -DgroupId=com.hanvon.demo -DartifactId=MavenDemo • 约定优于配置(Convention Over Configuration)

  7. validate: 验证项目是否正确以及相关信息是否可用。  • compile: 编译。  • test: 通过junit进行单元测试。  • package: 根据事先指定的格式(比如jar),进行打包。  • integration-test: 部署到运行环境中,准备进行集成测试。  • verify: 对包进行有效性性和质量检查。  • install: 安装到本地代码库。  • deploy: 在集成或发布环境,将包发布到远程代码库。  • clean: 清除以前的构建物。  • site: 生成项目文档。 

  8. How to Use Maven(1) • Configuration 修改C:\Users\${UserName}\.m2\settings.xml • 定义远程仓库: <profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <name>hanvon private nexus</name> <url>http://172.16.8.210:8081/nexus/content/groups/public </url> </repository> </repositories> </profile>

  9. How to Use Maven(2) • Configuration 修改C:\Users\${UserName}\.m2\settings.xml • 定义远程认证: <server> <id>releases</id> <username>developer</username> <password>hanvon_dev</password> </server> <server> <id>Snapshots</id> <username>developer</username> <password>hanvon_dev</password> </server>

  10. How to Use Maven(3) • 激活配置 <activeProfiles> <activeProfile>nexus</activeProfile> <activeProfile>nexus- snapshots</activeProfile> <activeProfile>nexus- releases</activeProfile> </activeProfiles>

  11. Maven with Eclipse (1) • Installation http://m2eclipse.sonatype.org/sites/m2e/ • Configuration 修改eclipse.ini -vm ${JDK_HOME\bin\javaw}

  12. Maven with Eclipse (2) • Validation

More Related