• Maven的安装


    一.Maven的相关

      Maven作为一款项目管理工具,表现非常的出色,Maven规范了整个组织的构建系统,将开发者从恐怖烦人的每日手工构建出解放出来,并且Maven将JAR包规范管理,JRA包的版本变的非常清晰,Maven的依赖管理,自动生成项目站点等特性也是一大亮点。

    Maven官方网站:http://maven.apache.org/ (可在右侧下载不同版本的Maven)

    二.下载安装Maven

      我使用的Maven2.2.1,下载apache-maven-2.2.1-bin.zip,解压到C盘根目录,解压后路径如下:C:\apache-maven-2.2.1。

    环境变量配置如下图:

    编辑Path:

    新增环境变量:M2_HOME:

    验证是否安装成功:

    运行-->cmd-mvn -version

    三.配置

     Maven中有两个重要的配置文件:settings.xml和pom.xml,setting.xml用于配置对于仓库的设置和代理仓库等设置,而pom.xml则对当前项目的管理。 

     打开C:\apache-maven-2.2.1\conf\settings.xml。项目不同settings.xml配置不同,我的配置如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
    http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <profiles>
            <profile>
                <id>nexus</id>
                <repositories>
                    <repository>
                        <id>nexus</id>
                        <name>Nexus</name>
                        <url>http://172.16.9.54:8081/nexus/content/groups/public</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>nexus</id>
                        <name>Nexus</name>
                        <url>http://172.16.9.54:8081/nexus/content/groups/public</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
            <profile>
                <id>jdk-1.6</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                    <jdk>1.6</jdk>
                </activation>
                <properties>
                    <maven.compiler.source>1.6</maven.compiler.source>
                    <maven.compiler.target>1.6</maven.compiler.target>
                    <maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion>
                </properties>
            </profile>
        </profiles>
        <activeProfiles>
            <activeProfile>nexus</activeProfile>
        </activeProfiles>
        <mirrors>
            <mirror>
             <id>nexus</id>
             <mirrorOf>*</mirrorOf>
            <url>http://172.16.9.54:8081/nexus/content/groups/public</url>
           </mirror>
        </mirrors>
        <servers>
            <server>
                <id>libs-releases-local</id>
                <username>sitech</username>
                <password>sitech</password>
            </server>
            <server>
                <id>libs-snapshots-local</id>
                <username>sitech</username>
                <password>sitech</password>
            </server>
        </servers>
        <pluginGroups>
            <pluginGroup>org.mortbay.jetty</pluginGroup>
        </pluginGroups>
    </settings>

    标签含义如下:

     关于settings.xml更详细配置参见博文:http://blog.csdn.net/yu624774720hua/article/details/6582188

  • 相关阅读:
    ubuntu十年
    国内开源镜像站
    vi 配置文件
    如何查看Linux命令源代码
    gedit乱码问题的解决
    Linux启动项修复
    我写新年愿望
    SEGGER J-Link 弹窗 在altium designer中禁用USBJATG
    线缆测试,手机端程序说明
    养兔场 网站上的个人介绍
  • 原文地址:https://www.cnblogs.com/zhishan/p/2765901.html
Copyright © 2020-2023  润新知