|
楼主
发表于 2015-5-18 22:26:17
|
查看: 1936 |
回复: 0
1、设置环境变量 M2_HOme,指向maven主目录
2、在Eclipse中,Windows-> reference->Java->Install Jres->选中JDK->Edit,在Default VM arguments后输入:
-Dmaven.multiModuleProjectDirectory=$M2_HOME
特别说明:需要使用JDK而不是JRE
3、maven主setting.xml或用户setting.xml中设置:
(1)、用户名与密码
- <server>
- <id>myjar</id>
- <username>admin</username>
- <password>abcd</password>
- </server>
- <server>
- <id>Release</id>
- <username>admin</username>
- <password>abcd</password>
- </server>
- <server>
- <id>Snapshot</id>
- <username>admin</username>
- <password>abcd</password>
- </server>
- <server>
- <id>nexus</id>
- <username>admin</username>
- <password>yjghdl</password>
- </server>
复制代码 注意:id要和项目中的d<istributionManagement>中<repository>的ID相同
(2)、profiles
- <profile>
- <id>dev</id>
- <activation>
- <jdk>1.7</jdk>
- </activation>
- <repositories>
- <repository>
- <id>nexus</id>
- <name>my-nexus</name>
- <url>http://123.57.248.xxx:8080/content/groups/public/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>nexus</id>
- <name>my-nexus</name>
- <url>http://123.57.248.xxx:8080/content/groups/public/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- </profiles>
- <activeProfiles>
- <activeProfile>dev</activeProfile>
- </activeProfiles>
复制代码 4、项目pom.xml中设置:- <distributionManagement>
- <repository>
- <id>Release</id>
- <name>HcSoft.JVA2 Release Repository</name>
- <url>http://123.57.248.121:8080/nexus/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>Snapshot</id>
- <name>HcSoft.JVA2 Snapshot Repository</name>
- <url>http://123.57.248.121:8080/nexus/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
复制代码
url请换成你maven私服url
5、在maven服务器中设置对应仓库的Deployment Policy为Allow Redploy
6、打开或新建项目,Run-->Run Configuration-->Maven Building ,新建一个项目,在Goals后面输入:deploy -e,选择其他参数(一般用缺省值即可),保存并运行
当然,如果你还可以手工打包,然后再用mvn -Ddeploy命令发布(可参见本JAVA论坛中:maven路程6:各类数据库驱动包大全)
------------------------------------------------------------------------
其他 :nexus服务器可以不用独立运行,如果你服务器配置比较低,建议和其他项目共用tomcat服务器,以减少对资源的占用。(经测试,与tomcat集成之后更消耗资源)
|
|