Linux下安装maven

9 篇文章 0 订阅

(1)首先下载maven,下载地址 http://maven.apache.org/download.cgi

然后上传:apache-maven-3.0.4-bin.tar.gz

解压命令:tar -zxvf apache-maven-3.0.4-bin.tar.gz

移动命令:mv apache-maven-3.0.4 /usr/local/apache-maven-3.0.4

  

(2)配置maven环境变量:

编辑命令:vim /etc/profile

编辑内容:

#maven

export MAVEN_HOME=/usr/local/apache-maven-3.0.4

export PATH=.:$ZOOKEEPER_HOME/bin:$STORM_HOME/bin:$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH

重新启动 source /etc/profile 生效

  

(3)进行 maven 的 settings.xml 配置

命令:vim /usr/local/apache-maven-3.0.4/conf/settings.xml

修改内容,详见 settings.xml

  

<localRepository>/usr/local/apache-maven-3.0.4/Repository</localRepository>

  

<!--配置权限,使用默认用户-->

<servers>

<server>

<id>nexus-releases</id>

<username>deployment</username>

<password>deployment123</password>

</server>

<server>

<id>nexus-snapshots</id>

<username>deployment</username>

<password>deployment123</password>

</server>

</servers>

  

 

<profiles>

<profile>

<id>nexus-bhz</id>

<activation>

<activeByDefault>true</activeByDefault>

<jdk>1.7</jdk>

</activation>

<properties>

<maven.compiler.source>1.7</maven.compiler.source>

<maven.compiler.target>1.7</maven.compiler.target>

<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>

</properties>

<repositories>

<!-- 私有库地址-->

<repository>

<id>nexus</id>

<url>http://localhost:8081/nexus/content/groups/public/</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>true</enabled>

</snapshots>

</repository>

</repositories>

<pluginRepositories>

<!--插件库地址-->

<pluginRepository>

<id>nexus</id>

<url>http://localhost:8081/nexus/content/groups/public/</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>true</enabled>

</snapshots>

</pluginRepository>

</pluginRepositories>

</profile>

</profiles>

<!-- 激活 -->

<activeProfiles>

<activeProfile>nexus-bhz</activeProfile>

</activeProfiles>

  

建立 Repository 文件夹 存放的是 从私服上面下载下来的包。

命令: mkdir /usr/local/apache-maven-3.0.4/Repository

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值