Linux Maven安装

文章目录

        • 1、下载
        • 2、解压
        • 3、环境变量
        • 4、配置文件详解

1、下载

官网:http://maven.apache.org/download.cgi
Linux Maven安装_第1张图片

2、解压

tar zxvf apache-maven-3.6.1-bin.tar.gz -C /opt/

解压之后的目录为 : /opt/apache-maven-3.6.1/

3、环境变量

vim /etc/profile

在打开的文件最后面添加以下信息

export M2_HOME=/opt/apache-maven-3.6.1
export PATH=$PATH:$M2_HOME/bin

让配置生效

source /etc/profile

验证是否安装完成

mvn -version

在这里插入图片描述
至此,安装成功!

4、配置文件详解


<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>C:\Users\asus\.m2\repositorylocalRepository>
    
	<pluginGroups>
        
    pluginGroups>
    
	<proxies>
        
    proxies>
    
	
    <servers>
        
        <server>
            <id>releasesid>
            <username>adminusername>
            <password>admin123password>
        server>
        <server>
            <id>snapshotsid>
            <username>adminusername>
            <password>admin123password>
        server>
    servers>
    
	
	<mirrors>
        
        <mirror>
            <id>nexusid>
            <mirrorOf>*mirrorOf>
            <url>http://nexus.xbdream.cn:8000/content/groups/public/url>
        mirror>
        
        
    mirrors>
    
    
	<profiles>
        <profile>
            <id>myProfileid>
            
            <activation>
                <activeByDefault>trueactiveByDefault>
				<jdk>1.8jdk>
            activation>

			
            <properties>
                <jdk.version>1.8jdk.version>
                <maven.compiler.source>1.8maven.compiler.source>
                <maven.compiler.target>1.8maven.compiler.target>
                <encoding>UTF-8encoding>
            properties>
            
			
            <repositories>
                <repository>
                    <id>nexusid>
                    <name>Nexusname>
                    <url>http://nexus.xbdream.cn:8000/content/groups/public/url>
                    
                    <releases><enabled>trueenabled>releases>
                    
                    <snapshots><enabled>trueenabled>snapshots>
                repository>
            repositories>
            
			
            <pluginRepositories>
                <pluginRepository>
                    <id>nexusPluginRepositoriesid>
                    <url>http://nexus.xbdream.cn:8000/content/groups/public/url>
                    
                    <releases><enabled>trueenabled>releases>
                    
                    <snapshots><enabled>trueenabled>snapshots>
                pluginRepository>
            pluginRepositories>
        profile>
    profiles>

settings>

你可能感兴趣的:(maven,Linux,Linux)