在Apache官网上下载bin文件,解压到相应目录。然后配置/etc/profile即可,环境变量名为M2_HOME,如下:(配置完后注意source /etc/profile)
#Maven
export M2_HOME=/usr/local/apache-maven-3.3.1
export PATH=$PATH:$M2_HOME/bin
由于编译时要下载很多东西,我们可以编辑maven\conf\settings.xml文件,将镜像站点改为中国开源镜像点,如下:
<mirrors>
    <mirror>

<id>nexus-osc</id>

<mirrorOf>*</mirrorOf>

<name>Nexusosc</name>

<url>http://maven.oschina.net/content/groups/public/</url>

</mirror>
</mirrors>
和(注意不要把这个文件改错了)
<profiles>
<profile>
    <id>jdk-1.7</id>
        <activation>

<jdk>1.7</jdk>

</activation>
        <repositories>

<repository>

<id>nexus</id>

<name>local private nexus</name>

<url>http://maven.oschina.net/content/groups/public/</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>false</enabled>

</snapshots>

</repository>

</repositories>

<pluginRepositories>

<pluginRepository>

<id>nexus</id>

<name>local private nexus</name>

<url>http://maven.oschina.net/content/groups/public/</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>false</enabled>

</snapshots>

</pluginRepository>

</pluginRepositories>

</profile>
</profiles>
然后将这个maven\conf\settings.xml文件拷贝到~/.m2文件夹下,保证用户每次使用maven都可以用到这个配置(.m2是个隐藏文件夹)

最新文章

  1. easyui与ueditor合用问题
  2. Could not publish server configuration for Tomcat v6.0 Server at localhost.
  3. 什么是 Help Desk?
  4. JavaScrip操作Cookie
  5. ZWave for Arduino
  6. 算法优化:rgb向yuv的转化最优算法,快得让你吃惊!
  7. MySQL锁详解
  8. Android仿微信朋友圈,全文收起功能,附源码
  9. Spring Cloud搭建微服务架构----前言
  10. 深入理解 Android 消息机制原理
  11. 学习笔记-JS公开课三
  12. 微信小程序点击列表添加 去除属性
  13. 廖雪峰Git入门教程
  14. RabbitMQ(3) Spring boot集成RabbitMQ
  15. Servlet执行流程和生命周期
  16. QT 小总结
  17. Atom与markdown
  18. LeetCode之有效括号
  19. Java 管道PipedInputStream PipedOutStream PipedReader PipedWriter
  20. 组学航母----OMICtools

热门文章

  1. C++中无法解析的外部符号错误
  2. [Javascript] Ternary Conditionals
  3. python下载文件的三种方法
  4. 【C#】利用JMail发送邮件
  5. hdu1874 畅通project续(求最短路径)
  6. Python编程-基础知识-List
  7. Java从零开始学三十三四(JAVA IO-流简述)
  8. java—(2)maven基本命令
  9. 算法笔记_195:历届试题 错误票据(Java)
  10. vb中adOpenKeyset, adLockOptimistic