失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > IDE---- 在 开发工具中使用 Maven

IDE---- 在 开发工具中使用 Maven

时间:2018-12-10 01:23:50

相关推荐

IDE---- 在 开发工具中使用 Maven

1.1 安装 Maven 核心程序

下载地址:/检查 JAVA_HOME 环境变量。Maven 是使用 Java 开发的,所以必须知道当前

系统环境中 JDK 的安装目录。解压 Maven 的核心程序。

将 apache-maven-3.6.3-bin.zip 解压到一个非中文无空格的目录下。例如:

D:\apache-maven-3.6.3

配置环境变量。

MAVEN_HOME

D:\apache-maven-3.6.3

path

%MAVEN_HOME%\bin

④查看 Maven 版本信息验证安装是否正确

mvn -v

配置本地仓库和阿里云镜像

Maven 默认的本地仓库:~.m2\repository 目录。

配置文件目录 D:\apache-maven-3.6.3\conf\settings.xml

配置本地仓库:

<!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>-->

配置案例云镜像

<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>/repo/path</url></mirror>--><mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>/nexus/content/groups/public</url></mirror></mirrors>

Eclipse配置Maven插件

Eclipse 中默认自带 Maven 插件,但是自带的 Maven 插件不能修改本地仓库

点击 Eclipse 中的 Window→Preferences

Eclipse创建Maven工程

配置右键新建菜单中有maven project

每次创建工程时版本都是1.5,如何修改

settings.xml 文件中添加以下配置将编译版本改为 1.8,重启 Eclipse 即可

<profile><id>jdk-1.8</id><activation><activeByDefault>true</activeByDefault><jdk>1.8</jdk></activation><properties><piler.source>1.8</piler.source><piler.target>1.8</piler.target><pilerVersion>1.8</pilerVersion></properties></profile>

在pom.xml文件中添加坐标 并保存测试

<dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version><scope>test</scope></dependency></dependencies>

idea 创建maven工程

idea也有自带的maven插件,且有配置文件可以进行配置,在安装目录中的plubins中

转web工程使用该插件可以一键转

如果觉得《IDE---- 在 开发工具中使用 Maven》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。