开发工具与关键技术: Java
作者:肖广斌
撰写时间:2020年10月8日

在我们刚新建完一个maven web项目的时候,都会有一个pom.xml文件,文件的开头一般都是我们在新建项目时候填写的基本信息,比如有标识,打包方式还有项目名称什么的,如下图
在这里插入图片描述
那么在这个xml文件中我们应该配置写什么呐,我们可以在里面配置我们项目所需要用到的组件依赖,在配置组件依赖前我们先需要去官网下载一个apache-maven-3.6.3,(这里我用的是3.6.3)然后解压,接着我们需要修改一下它的配置,打开解压完成后的apache-maven找到settings.xml文件,用记事本打开,把localRepository本地仓库的路径修改成自己想要放置的路径,再往下找mirror,配置一个阿里云公共仓库的下载路径,就是说如果你的配置文件中有依赖包,那么它首先就会在你本地仓库找,如果本地仓库找不到,就会去阿里云公共仓库下载到你的本地仓库里,如下图
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
修改完成后,把它导入eclipse中选择并应用,把路径修改成刚刚的settings.xml文件的路径点击update就行了
在这里插入图片描述
在这里插入图片描述
接着我们就在pom.xml文件中根据项目需求配置项目相关的依赖,使用标签在里面添加配置相关的依赖包和版本号,还可以配置mapper的xml文件和其他资源位置,只要使用对应的标签进行配置就行,配置我们的项目编译插件jdk的版本等,如果我们本地仓库中没有这些依赖包的话,需要联网它才能在阿里云公共仓库中下载喔,下载时不要随便中断网络,不然可能引发各种报错
在这里插入图片描述
在这里插入图片描述

GitHub 加速计划 / ma / maven
36
0
下载
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:8 天前 )
3207daa8 Bumps [net.sourceforge.pmd:pmd-core](https://github.com/pmd/pmd) from 7.16.0 to 7.17.0. - [Release notes](https://github.com/pmd/pmd/releases) - [Changelog](https://github.com/pmd/pmd/blob/main/docs/render_release_notes.rb) - [Commits](https://github.com/pmd/pmd/compare/pmd_releases/7.16.0...pmd_releases/7.17.0) --- updated-dependencies: - dependency-name: net.sourceforge.pmd:pmd-core dependency-version: 7.17.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 17 小时前
9f87ad4d This PR moves the InputLocation, InputLocationTracker, and InputSource classes from maven-api-model to be generated using the existing velocity templates in src/mdo/java/. Changes Made: - Updated Velocity Templates with Maven-specific features controlled by isMavenModel parameter - Added locationTracking=true and generateLocationClasses=true parameters to maven-api-model configuration - Removed manually written InputLocation classes from api/maven-api-model/src/main/java/org/apache/maven/api/model/ Benefits: - Consistency: InputLocation classes are now generated consistently across all Maven modules - Maintainability: Changes can be made in one place (the templates) rather than maintaining separate implementations - Feature Parity: All Maven-specific features are preserved through the isMavenModel boolean parameter - Code Reuse: The same templates can generate both simple and Maven-enhanced versions 19 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐