网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 网络学院 >> 程序设计 >> Java编程 >> 文章正文
  maven2的配置            【字体:
maven2的配置
作者:佚名    文章来源:不详    点击数:    更新时间:2007-9-2    

配置:

打开${maven.home}/conf下面的Setting.xml,为了大家对照方便,我只在原来的基础上更改,顺序按从上往下

配置本地Repository(储藏室)

<settings>

<!-- localRepository

| The path to the local repository maven will use to store artifacts.

|

| Default: ~/.m2/repository

-->

<localRepository>E:/LoaclRepository/m2</localRepository>

其中E:/LoaclRepository/m2是本地Repository,这个必须时绝对路径。
正在装载数据……
如果不改的话默认路径是在
C:Documents and Settingsusername%.m2下。其中%username%为操作系统登录用户名,这样不方便维护。

与用户的交互模式

<!-- interactiveMode

| This will determine whether maven prompts you when it needs input. If set to false,

| maven will use a sensible default value, perhaps based on some other setting, for

| the parameter in question.

|

| Default: true

<interactiveMode>true</interactiveMode>

-->

默认为true,当需要输入参数时Maven会提示用户输入参数,如果设置为false,则在遇到有输入参数时不会提示用户,Maven会自己生成一些参数,这样可能会出错,一般不需要改变默认设置。

是否连接互联网

<!-- offline

| Determines whether maven should attempt to connect to the network when executing a build.

| This will have an effect on artifact downloads, artifact deployment, and others.

|

| Default: false

<offline>false</offline>

-->

当运行的时候,决定 Maven 是否尝试与网络建立连接。这样可能会对已有的本地储藏室中的自定义.jar文件产生影响,默认为false,一般不需要改。

配置代理服务器(如果你使用代理服务器上网的话)

<!-- proxies

| This is a list of proxies which can be used on this machine to connect to the network.

| Unless otherwise specified (by system property or command-line switch), the first proxy

| specification in this list marked as active will be used.

|-->

<proxies>

<!-- proxy

| Specification for one proxy, to be used in connecting to the network.

|

-->

<proxy>

<id>optional</id> <!--代理服务器ID,可随意命名-->

<active>true</active> <!-- 是否启用 -->

<protocol>http</protocol> <!-- 通信协议 -->

<username>proxyuser</username> <!-- 代理服务器用户名 -->

<password>proxypass</password> <!-- 代理服务器密码 -->

<host>proxy.host.net</host> <!-- 代理服务器主机地址 -->

<port>80</port> <!-- 通信端口 -->

<nonProxyHosts></nonProxyHosts>

</proxy>

</proxies>

其中proxy.host.net是你的代理服务器主机地址

展开我的项目到远程服务器

Pom文件:

<distributionManagement>

<repository>

<id>mycompany-repository</id>

<name>MyCompany Repository</name>

<url>scp://repository.mycompany.com/repository/maven2</url>

</repository>

<!-- servers

| This is a list of authentication profiles, keyed by the server-id used within the system.

| Authentication profiles can be used whenever maven must make a connection to a remote server.

|-->

<servers>

<!-- server

| Specifies the authentication information to use when connecting to a particular server, identified by

| a unique name within the system (referred to by the 'id' attribute below).

|

| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are

| used together.

|

<server>

<id>deploymentRepo</id>

<username>repouser</username>

<password>repopwd</password>

</server>

-->

 

<!-- Another sample, using keys to authenticate. -->

<id>mycompany-repository</id>

<username>jvanzyl</username>

<!-- Default value is ~/.ssh/id_dsa -->

<privateKey>/path/to/identity</privateKey> (default is ~/.ssh/id_dsa)

<passphrase>my_key_passphrase</passphrase>

</servers>

 

注意红色代码部分;

设置多个远程镜像

<mirrors>

<!-- mirror

| Specifies a repository mirror site to use instead of a given repository. The repository that

| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used

| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.

|

-->

<mirror>

<id>ggi-project.org</id>

<url>http://ftp.ggi-project.org/pub/packages/maven2</url>

<mirrorOf>central</mirrorOf>

</mirror>

<mirror>

<id>planetmirror.com</id>

<url>http://public.planetmirror.com/pub/maven2</url>

<mirrorOf>central</mirrorOf>

</mirror>

<mirror>

<id>lsu.edu</id>

<url>http://ibiblio.lsu.edu/main/pub/packages/maven2</url>

<mirrorOf>central</mirrorOf>

</mirror>

<mirror>

<id>ibiblio.net</id>

<url>http://www.ibiblio.net/pub/packages/maven2</url>

<mirrorOf>central</mirrorOf>

</mirror>

</mirrors>

这样可以设置多个镜像,加快下载速度

 


本文来源:http://blog.csdn.net/TomyGuan/archive/2007/07/16/1693727.aspx
站内文章搜索 高级搜索
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
     用java实现web服务器
     用java快速开发linux gu…
     正则表达式分解siemens交…
     [portal参考手册]目录
     jsp中调用oracle存储过程…
  • JSP中JavaBean的生命周期

  • Java Swing实现俄罗斯方块

  • java异常处理机制的深入理解

  • [转]Java堆和栈的区别 经典总…

  • HashTable和HashMap; Vecto…

  • 关于java Applet

  • java 设计工厂模式

  • Core Java 之旅

  • 专访Java之父:Java未来的发…

  • 开发手记---JAVA数据库连接池

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    网络学院©2007 www.23book.net
    为您提供web编程,vb编程,vc编程,服务器架设管理,数据库设计等方面的知识 站长:David