我是靠谱客的博主 悦耳黑夜,最近开发中收集的这篇文章主要介绍Linux中Maven的下载与配置,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1.下载:
https://maven.apache.org/index.html
在这里插入图片描述

2.配置:
a.解压接归档
进入下载目录右键打开终端输入命令
在这里插入图片描述
b.然后进入到apache-maven-3.8.5目录中
继续进入conf
先把此文档l(lxh.md)的内容全部复制
然后双击进入settings.xml
Ctrl+A Ctrl+V
Ctrl +S(保存然后退出)
在主目录里面建立一个.m2目录
进入.m2然后将刚刚做好的settings文件复制粘贴过来
配置完成
lxh.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">
<!-- pluginGroup

 | Specifies a further group identifier to use for plugin lookup.

<pluginGroup>com.your.plugins</pluginGroup>

-->
<!-- proxy

 | Specification for one proxy, to be used in connecting to the network.

 |

<proxy>

  <id>optional</id>

  <active>true</active>

  <protocol>http</protocol>

  <username>proxyuser</username>

  <password>proxypass</password>

  <host>proxy.host.net</host>

  <port>80</port>

  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>

</proxy>

-->
<!-- server

 | Specifies the authentication information to use when connecting to a particular server, identified by

 | a unique name within the system (referred to by the 'id' attribute below).

 |

 | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are

 |       used together.

 |

<server>

  <id>deploymentRepo</id>

  <username>repouser</username>

  <password>repopwd</password>

</server>

-->



<!-- Another sample, using keys to authenticate.

<server>

  <id>siteServer</id>

  <privateKey>/path/to/private/key</privateKey>

  <passphrase>optional; leave empty if not used.</passphrase>

</server>

-->
<!-- mirror

 | Specifies a repository mirror site to use instead of a given repository. The repository that

 | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used

 | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.

 |

<mirror>

  <id>mirrorId</id>

  <mirrorOf>repositoryId</mirrorOf>

  <name>Human Readable Name for this Mirror.</name>

  <url>http://my.repository.com/repo/path</url>

</mirror>

 -->

<!-- 阿里云仓库 -->

    <mirror>

        <id>alimaven</id>

        <mirrorOf>central</mirrorOf>

        <name>aliyun maven</name>

        <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>

    </mirror>

	



	<!-- 中央仓库1 -->

    <mirror>

        <id>repo1</id>

        <mirrorOf>central</mirrorOf>

        <name>Human Readable Name for this Mirror.</name>

        <url>http://repo1.maven.org/maven2/</url>

    </mirror>

 

    <!-- 中央仓库2 -->

    <mirror>

        <id>repo2</id>

        <mirrorOf>central</mirrorOf>

        <name>Human Readable Name for this Mirror.</name>

        <url>http://repo2.maven.org/maven2/</url>

    </mirror>
<!-- profile

 | Specifies a set of introductions to the build process, to be activated using one or more of the

 | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>

 | or the command line, profiles have to have an ID that is unique.

 |

 | An encouraged best practice for profile identification is to use a consistent naming convention

 | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.

 | This will make it more intuitive to understand what the set of introduced profiles is attempting

 | to accomplish, particularly when you only have a list of profile id's for debug.

 |

 | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.

<profile>

  <id>jdk-1.4</id>



  <activation>

    <jdk>1.4</jdk>

  </activation>



  <repositories>

    <repository>

      <id>jdk15</id>

      <name>Repository for JDK 1.4 builds</name>

      <url>http://www.myhost.com/maven/jdk15</url>

      <layout>default</layout>

      <snapshotPolicy>always</snapshotPolicy>

    </repository>

  </repositories>

</profile>

-->



<!--

 | Here is another profile, activated by the system property 'target-env' with a value of 'dev',

 | which provides a specific path to the Tomcat instance. To use this, your plugin configuration

 | might hypothetically look like:

 |

 | ...

 | <plugin>

 |   <groupId>org.myco.myplugins</groupId>

 |   <artifactId>myplugin</artifactId>

 |

 |   <configuration>

 |     <tomcatLocation>${tomcatPath}</tomcatLocation>

 |   </configuration>

 | </plugin>

 | ...

 |

 | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to

 |       anything, you could just leave off the <value/> inside the activation-property.

 |

<profile>

  <id>env-dev</id>



  <activation>

    <property>

      <name>target-env</name>

      <value>dev</value>

    </property>

  </activation>



  <properties>

    <tomcatPath>/path/to/tomcat/instance</tomcatPath>

  </properties>

</profile>

-->

<profile>     

  <id>jdk</id>   

  <activation>        

        <activeByDefault>true</activeByDefault>    

        <jdk>17</jdk>      

  </activation>  

  <properties>  

	<maven.compiler.source>17</maven.compiler.source> 

	<maven.compiler.target>17</maven.compiler.target> 

	<maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>   

	<maven.compiler.encoding>utf-8</maven.compiler.encoding>

	<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>

	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

	<maven.test.failure.ignore>true</maven.test.failure.ignore>

	<maven.test.skip>true</maven.test.skip>

  </properties>

</profile>

最后

以上就是悦耳黑夜为你收集整理的Linux中Maven的下载与配置的全部内容,希望文章能够帮你解决Linux中Maven的下载与配置所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部