ALL is Well!

敏捷是一条很长的路,摸索着前进着

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  30 随笔 :: 23 文章 :: 71 评论 :: 0 Trackbacks
位于Maven2安装目录conf文件夹下的settings.xml文件,是maven2作为全局性质的配置。
打开刚刚安装的Maven2的settings.xml文件,里面基本都是被注释掉了的。
settings.xml有主要有下面几个配置节点:

localRepository:用于设置本地仓库的位置。如果不设置此节点,则本地仓库在 ${user.dir}/.m2/repository。
<localRepository>C:/maven/repository</localRepository>

offline:当offline设置为ture,则在编译时,maven2不会去远程仓库(即互联网)下载依赖包。一般我们不用去设置这个节点。因为在我们开始使用之初,我们是没有这些依赖包的,要由maven2去仓库中下载。以后再使用时,maven2会先检查本地仓库是否有依赖包,有则不需要到远程仓库去下载了。

Proxies:此节点是为不能直接访问远程仓库的用户准备的。能直接联网的,不需要设置。

properties:此节点可配置placeholder值。(简单的应用,不需要设置)

activeProfiles:标识激活的profile。
  <activeProfiles>
    
<activeProfile>localrepo</activeProfile>
  
</activeProfiles>

Profiles:主要包括activation,repositories,pluginRepositories 和properties元素。进行个性化配置,如配置私服等。
单独配置了Profile后,不能生效,需要通过 activeProfiles 激活才行。
<profiles>
    
<profile>
      
<id>localrepo</id>
      
<activation>
        
<jdk>1.6</jdk>
      
</activation>
      
<repositories>
        
<repository>
          
<id>central</id>
          
<name>artifactory at local</name>
          
<url>http://localhost:8081/artifactory/repo</url>
          
<layout>default</layout>
          
<snapshots>   
            
<enabled>false</enabled>   
         
</snapshots>
        
</repository>
        
<repository>   
         
<id>snapshots</id>   
          
<url>http://localhost:8081/artifactory/repo</url>   
           
<releases>   
            
<enabled>false</enabled>   
           
</releases>   
        
</repository>
      
</repositories>
    
</profile>
</profiles>

以上介绍的,都是在以后的配置会用到的。


settings.xml的一些更详细的说明这里就不说了。

本文为原创,欢迎转载,转载请注明出处BlogJava

posted on 2010-09-03 13:34 李 明 阅读(627) 评论(0)  编辑  收藏 所属分类: Maven2

只有注册用户登录后才能发表评论。


网站导航: