| Version 10 (modified by qinhongyuan, 14 years ago) (diff) |
|---|
Maven使用(以新游戏大厅为例)
命名:
<groupId>cn.pconline.项目组</groupId> <artifactId>项目名称</artifactId> <version>版本</vernsion>
添加依赖:
所谓依赖就是开始时候所需要的包
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>3.0.6.RELEASE</version> </dependency>
添加中心库: 所谓中心库就是包存放的地方或者是代理的地方
<repository> <id>gamehall</id> <name>Repository hosting the gamehall</name> <url>http://192.168.75.11:8080/nexus-webapp-1.9.2.3/content/groups/public</url> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> <checksumPolicy>warn</checksumPolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <layout>default</layout> </repository>
添加依赖包时,只需要添加你所需要的那个依赖包就可以了,这个依赖包的相关依赖可以不用加,maven默认会自动帮我们加好
添加自己依赖包时,可以上传到本地仓库,也可以上传到nexus,下面是一个例子
mvn install:install-file -Dfile=fckeditor-java-core-2.6.jar -DgroupId=fckeditor-java-core -DartifactId=fckeditor-core -Dversion=2.6 -Dpackaging=jar -DgeneratePom=true
当然nexus提供界面操作上传
公司内部需要走代理访问外部的,所以在设置的时候也要加上代理 修改setting.xml文件
<proxy>
<id>pconline</id>
<active>true</active>
<protocol>http</protocol>
<host>192.168.11.254</host>
<port>8080</port>
</proxy>
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)