wiki:shareMaven

Version 9 (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提供界面操作上传