您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
08-Maven坐标(groupId,artifactId,version)
发布时间:2022-10-07 23:08:30编辑:雪饮阅读()
一般的,在maven项目中的pom.xml中的project节点的dependcies节点下有如:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
这里groupid是组织id,一般类似包名那样命名,www.gjp.com,则会com.gjp.www类似这样。
artifactId是模块名称,version就不用说了,是版本号。
所以这个依赖如果被安装在本地maven仓库,则结构就是D:\software\apache-maven-3.6.0-bin\apache-maven-3.6.0\maven_repository\junit\junit\4.9
这样。前面部分就是你的本地maven仓库路径。
这里组织id是junit所以结构是:
D:\software\apache-maven-3.6.0-bin\apache-maven-3.6.0\maven_repository\junit\junit\4.9
那么除了在dependency里面有maven坐标吗?不,在project根节点也可以有如:
局部代码如:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.itcast.maven</groupId>
<artifactId>maven-helloworld</artifactId>
<version>0.0.1-SNAPSHOT</version>
像是这个项目如果通过maven compile即编译后就会在本地仓库生成路径如:
D:\software\apache-maven-3.6.0-bin\apache-maven-3.6.0\maven_repository\cn\itcast\maven\maven-helloworld\0.0.1-SNAPSHOT
也就是说groupId啊它如果是点分隔的字符,则点会自动被认为是点前和点后的字符为父目录与子目录的关系进行生成的。
那么这个不是dependency里面的,想必dependency里面应也是如此。可以自行尝试下的。
关键字词:Maven,坐标,groupId,artifactId,version
上一篇:07-Idea配置Maven环境
相关文章
- 07-Idea配置Maven环境
- 05-Maven常用命令(compile、clean、package、install)
- 03-Maven仓库介绍(基于maven的项目的maven编译、仓库
- 02-Maven安装(windows下环境变量动态配置引用)
- sqlserver連接錯誤SSL routinesssl_choose_client_ver
- phpunit-phpunit.xml-phpunit-testsuites-testsuite-d
- phpunit-phpunit.xml-phpunit-testsuites-testsuite-d
- 使maven项目支持eclipse并导入eclipse
- 从maven模板创建一个java项目
- win10下maven3.8.2安装配置