Java11配置maven
这里假设Java11和maven都正确安装,使用的版本为Java11、maven3.6.1
测试环境变量
Java
win + r 打开运行,输入 cmd,打开命令行提示符,输入java --version如下
C:\Users\siyu>java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
Maven
win + r 打开运行,输入 cmd,打开命令行提示符,输入mvn -v如下
C:\Users\siyu>mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: D:\Program Files (x86)\Maven\apache-maven-3.6.1\bin\..
Java version: 11.0.2, vendor: Oracle Corporation, runtime: D:\Program Files (x86)\openjdk\jdk-11
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Maven 镜像配置
因 Maven 默认镜像在国内下载限制,因此,建议更改为阿里云的镜像,方法如下:(建议修改 settings.xml 前先复制保持一份)
打开文件对应安装目录的settings.xml文件,例如我的目录是D:\Program Files (x86)\Maven\apache-maven-3.6.1\confsettings.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
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:\ProgramData\MavenRepo</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->
<!-- offline
| Determines whether maven should attempt to connect to the network when executing a build.
| This will have an effect on artifact downloads, artifact deployment, and others.
|
| Default: false
<offline>false</offline>
-->
<!-- pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|-->
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>
<!-- proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|-->
<proxies>
<!-- 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>
-->
</proxies>
<!-- servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|-->
<servers>
<!-- 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>
-->
</servers>
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<mirrors>
<!-- 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>huaweicloud</id>
<mirrorOf>*</mirrorOf>
<url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>
</mirrors>
...省略
<profiles>
...省略
<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-11</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>11</jdk>
</activation>
<!--
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
</properties> -->
</profile>
</profiles>
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>
<!-- activeProfiles
| List of profiles that are active for all builds.
|
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
-->
</settings>
解释
添加了本地仓库和国内镜像源
关联问题:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)
参考来源
Java11配置maven的更多相关文章
- eclipse内下载及配置maven插件(转)
本文介绍Maven的安装和配置,同样适用于eclipse 1.首先需要安装jdk,eclipse(废话!). 然后到maven官网下载maven,http://maven.apache.org/dow ...
- myeclipse配置maven
1.首先配置好java的运行环境(JDK要1.7及以上版本),网上有详细资料. 2.下载maven,具体下载链接http://maven.apache.org/download.html 3.下载ap ...
- Java 配置maven及阿里云镜像
一:配置maven 1.下载maven,选择Binary tar.gz,解压拷贝到目录/usr/local/ https://maven.apache.org/download.cgi 2.配置系统默 ...
- 使用IntelliJ IDEA 配置Maven(入门)【转】
1.在IntelliJ IDEA中配置maven 打开-File-Settings 2.新建maven WEB项目 打开-File-New-Project 点击NEXT 点击NEXT 添加的配置 ...
- 使用IntelliJ IDEA 配置Maven(入门)
1. 下载Maven 官方地址:http://maven.apache.org/download.cgi 解压并新建一个本地仓库文件夹 2.配置本地仓库路径 3.配置maven环境变量 ...
- 使用IntelliJ IDEA 配置Maven(入门)(转)
原文转自:http://blog.csdn.net/qq_32588349/article/details/51461182 1. 下载Maven 官方地址:http://maven.apache.o ...
- idea配置maven并添加镜像配置
1.打开maven存放文件夹找到 conf ->settings.xml 找到<mirrors>节点把下面内容写入节点内 配置为阿里云的镜像 <mirror> <i ...
- [转]maven安装以及eclipse配置maven
转自:http://jingyan.baidu.com/article/295430f136e8e00c7e0050b9.html 方法/步骤 下载maven的bin,在apache官方网站可以下载. ...
- Maven学习(一) -- 安装Maven及Eclipse中配置Maven
标签(空格分隔): 学习笔记 本文环境:Windows7, JDK1.7.0_76 安装及配置Maven环境变量 需要电脑中已经有Java环境 在控制台中输入:echo %JAVA_HOME%看是否能 ...
- Eclipse 配置Maven
Eclipse 配置Maven 下载Maven 首先在官网下载Maven:http://maven.apache.org/download.cgi 下载后将其解压到相应的位置 配置Maven环境变量 ...
随机推荐
- Java 判断一个字符串是否是对称字符串 例如"abc"不是对称字符串,"aba"、"abba"、"aaa"、"mnanm"是对称字符串
代码如下: public static void main(String[] args) { String str = "1QabcdcbaQ"; StringBuilder sb ...
- Java杂记————object.getClass()和object.class以及Java中的toString()方法的的区别
不说废话,直接上干货: (注意大小写:object为对象,Object为类) 1,object.getClass()它是Object类的实例方法,返回一个对象运行时的类的Class对象,换句话说,它返 ...
- Python copy & deeocopy 探究
简单来说,copy 复制创建新的容器,而引用容器内元素的地址不变.而 deepcopy 也对容器内的容器元素进行复制. 但是这种复制具体是什么体现呢?是否只是对第一层容器元素进行了复制?写了一段代码验 ...
- 高通个别驱动创建Buffer耗时高问题的解决
前言 最近在优化游戏的时候,发现在在高通特定驱动版本的机器上(855,855+等),创建VB的耗时跟VB的数量成正比,这个应该是驱动的bug.跟官方人员确认过,确实是有这个问题,他们给的解决方案是减少 ...
- 关于ChatGPT与机器时代的展望
关于 ChatGPT 与机器时代的展望 机器人这一概念,最初不是出自计算机科学家或工程师之手,而是来自于捷克的戏剧家卡雷尔·恰佩克(Karl Capek)在 1920 年编排的一出名为"罗森 ...
- Ubuntu Ctrl + Alt + [F1~F6] 图形化终端与命令行终端
在20.04的版本中,F1和F2是两个图形化终端,可以登陆不同的用户.(如果是相同的用户登陆,则进入的是同一个终端.) F4-F6都是命令行终端,即便使用相同的用户登陆,也是打开不同的终端. 说明,命 ...
- C#/.net/DotNet/Emgu.CV裁剪照片头像
头像裁剪有利于人脸识别批量照片预处理,安防领域可以快速通过视频定位人脸,进行抓拍,做人脸识别相关功能的可能会应用到人脸裁剪,以下是我在实践中应用的代码,如有需要复制粘贴即可使用. using Emgu ...
- Vue中 router与route的区别
$route对象 该对象表示当前的路由信息,包含当前URL解析得到的信息.包含当前的路径,参数,query对象等.其常用方法如下所示: $route.path 字符串,对应当前路由的路径,总是解析为绝 ...
- 原来ES7~12分别增加了这些属性呀
ES6也称为ES2015,于2015年发布,此后每年都有新增一些属性,分别命名为ES7~12,发布的年份分别对应2016年到2021年 ES7 includes方法 数组中新增了includes方法, ...
- CentOS7系统初始化个人配置
以下内容为个人最小化安装后的配置步骤 更换yum源为阿里云 yum install -y epel-release lrzsz wget yum-axelget mv /etc/yum.repos.d ...