美文网首页
Ubuntu 中使用 jenv 安装 JDK、maven

Ubuntu 中使用 jenv 安装 JDK、maven

作者: Wcy100 | 来源:发表于2017-01-03 18:25 被阅读191次

    1.jenv 是什么

    jenv 是一个快捷安装、切换本地 jdk、maven等 Java 开发相关环境的工具

    2.Ubuntu 如何安装 jenv

    # 在终端中输入以下命令安装 jenv ,之后请重新打开bash(重要)
    $ curl -L -s get.jenv.io | bash
    

    3.安装 JDK

    # 安装 JDK
    $ jenv install java 1.8.0_71
    $ jenv install java 1.7.0_75
    # 在当前 shell 中切换 JDK 版本
    $ jenv use java 1.8.0_71
    # 全局切换 JDK 版本
    $ jenv default java 1.8.0_71
    
    • 安装 maven
    $ jenv install maven 3.3.9
    $ jenv default maven 3.3.9
    
    • 配置 maven
      修改~/.m2/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">  
      <!-- 此处的仓库地址改成你的主目录下对应的仓库地址 -->  
      <localRepository>/home/wucongyou/.m2/repository</localRepository>  
      <interactiveMode>true</interactiveMode>  
      <usePluginRegistry>false</usePluginRegistry>  
      <offline>false</offline>  
      <mirrors> 
     <!-- 配置阿里云公共仓库 -->  
        <mirror> 
          <id>ali-maven</id>  
          <mirrorOf>central</mirrorOf>  
          <name>ali-maven</name>  
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url> 
        </mirror> 
      </mirrors>  
    </settings>
    

    相关文章

      网友评论

          本文标题:Ubuntu 中使用 jenv 安装 JDK、maven

          本文链接:https://www.haomeiwen.com/subject/lcenvttx.html