zoukankan      html  css  js  c++  java
  • maven入门--part2 安装

    Maven安装和配置

    (1)下载安装文件apache-maven-3.03-bin.tar

    (2)解压至安装目录,安装完毕

    (3)修改.bash_profile,修改maven安装路径,修改构建GC配置参数

    vim ~/.bash_profile
    ***********************************************
    export MAVEN_HOME=path/apache-maven-3.0.3
    export PATH=$PATH:$JAVA_HOME:$MAVEN_HOME/bin
    export MAVEN_OPTS='-Xmn400m -Xms1024m -Xmx1024m -Xss1m -XX:PermSize=384m -XX:MaxPermSize=384m'
    ***********************************************
    source ~/.bash_profile
    

    (4)添加settings.xml,放在用户目录下,不用默认的settings.xml是为了每个用户都有自己的配置

    mkdir ~/.m2
    vim ~/.m2/settings.xml
    ***********************************************
    <settings>
    <!-- 配置maven本地repository的位置,可选 -->
    <localRepository>/Users/xxx/.m2/repository</localRepository>
    <!-- 配置开发者打包jar并上传nexus的用户名和密码 -->
    <servers>
            <server>
                    <id>nexus-releases</id>
                    <username>admin</username>
                    <password>xxxxx</password>
            </server>
            <server>
                    <id>nexus-snapshots</id>
                    <username>admin</username>
                    <password>xxxxx</password>
            </server>
    </servers>
    <profiles>
    <!-- 配置maven私服的地址,maven在构建时会先从私服尝试下载,如找不到再从中央仓库下载 -->
    <profile>
           <id>nexus</id>
           <repositories>
                   <repository>
                           <id>nexus</id>
                           <name>local private nexus</name>
                           <url>http://123.45.56.78:8081/nexus/content/groups/public</url>
                   </repository>
           </repositories>
           <pluginRepositories>
                   <pluginRepository>
                           <id>local-plugin-repository</id>
                           <name>local private plugin repository</name>
                           <url>http://123.45.67.78:8081/nexus/content/groups/public</url>
                           <releases>
                                   <enabled>true</enabled>
                           </releases>
                           <snapshots>
                                   <enabled>false</enabled>
                           </snapshots>
                   </pluginRepository>
           </pluginRepositories>
    </profile>
    </profiles>
    <activeProfiles>
           <activeProfile>nexus</activeProfile>
    </activeProfiles>
    </settings>
    ***********************************************

    (5)验证:mvn -version 查看安装路径,确认是不是安装成功

  • 相关阅读:
    WEB-INF目录与META-INF目录的作用
    Spring中的jar包详解
    fatal: Could not read from remote repository.的解决办法
    如何解决failed to push some refs to git
    Spring Boot 集成servlet,发布为可直接运行的war包,方便后续打包为docker镜像。
    使用IntelliJ IDEA,gradle开发Java web应用步骤
    git 命令使用常见问题
    自己动手搭建Git服务器-Gitblit
    windows 安装git
    springMVC 接收数组参数,mybatis 接收数组参数,mybatis批量插入/批量删除案例
  • 原文地址:https://www.cnblogs.com/jijiji/p/6943967.html
Copyright © 2011-2022 走看看