Maven 基本概念——根目录、项目创建、坐标
|----src
| |----main
| | |----java ——存放项目的.java文件
| | |----resources ——存放项目资源文件,如spring, hibernate配置文件
| |----test
| | |----java ——存放所有测试.java文件,如JUnit测试类
| | |----resources ——存放项目资源文件,如spring, hibernate配置文件
|----target ——项目输出位置
pom.xml文件中的内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!--所有的Maven项目都必须配置这四个配置项-->
<modelVersion>4.0.0</modelVersion>
<!--groupId指的是项目名的项目组,默认就是包名-->
<groupId>cn.zang.maven.hello</groupId>
<!--artifactId指的是项目中的某一个模块,默认命名方式是"项目名-模块名"-->
<artifactId>hello-first</artifactId>
<!--version指的是版本,这里使用的是Maven的快照版本-->
<version>SNAPSHOT-0.0.1</version>
</project>
可以看到,Maven帮我们创建的项目是一个标准的Maven项目,不过目前Maven只是帮我们生成了src/main/java(存放项目的源代码)和src/test/java(存放测试源代码)这两个目录,但实际项目开发中我们一般都会有配置文件,例如log4j.properties,所以我们还需要手动创建src/main/resources(存放项目开发中用到的配置文件,如存放log4j.properties等)和src/test/resources(存放测试时用到的配置文件),如下图所示:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkEAAAC4CAIAAABrZK8CAAAgAElEQVR4nO2deXwb1b3onb62r3299NLbd9umwC3lXgq0N5dy4V0mcPs+tGVrC9yFvvZ2oS2XgiFkIQ3N4gRISAKEhmwkEGVVCCGJQxIvcaw43h3v8m7Llm1ZXmJ50T7aLM9I5/0xWkazaUbSWCP79/2cjz+j0dGZMxrlfHPOnDm/LJtt8o2jVyBBggQJEqSMS1mUwxAAAAAAZBrgMAAAACBTAYcBAAAAmQo4DAAAAMhUOBymVd3XfPDexg/uqd9/t9Fo9Hq96aocAAAAAAjAdJhWdR/97erd321oa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kYYtN6qdEn70ElH8pBQCHAYDCAYclSPIxMEUGVWG/FL+R5LFSgvIvpQDgMABQOOCwBEk+BqYY07DfSqHD4h4rJSj/UgoADgMAhQMOS5AkY2Dy3Xli7BfZW8riIu4RxRwreZR/KQUAhwGAwgGHJUiqYmDOe5R/KQUAhwGAwgGHJUiSMTAXDsq/lAKAwwBA4YDDEgRiYIpE+ZdSAHAYACgccFjiQAxMMWTEpeQDHAYACke5DoM0b1K6f02JAw4DAIWjUIcBgBIAhwGAwgGHAQAv4DAAUDhKdBgElgQUAjgMABTO/wdWUJyfN3vbowAAAABJRU5ErkJggg==" alt="" />
然后我们就可以将创建好的myapp项目导入到Eclipse中进行开发了,如下图所示:
1、pom意思就是project object model。
2、pom.xml包含了项目构建的信息,包括项目的信息、项目的依赖等。
3、pom.xml文件是可以继承的,大型项目中,子模块的pom.xml一般都会继承于父模块的pom.xml
pom.xml文件的内容如下:
<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>com.mycompany.app</groupId>
<artifactId>myapp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging> <name>myapp</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency> </dependencies> </project>
pom.xml文件的节点元素说明:
<project> pom文件的顶级节点
<modelVersion> object model版本,对Maven2和Maven3来说,只能是4.0.0
<groupId> 项目创建组织的标识符,一般是域名的倒写
<artifactId> 定义了项目在所属组织的标识符下的唯一标识,一个组织下可以有多个项目
<version> 当前项目的版本,SNAPSHOT,表示是快照版本,在开发中
<packaging> 打包的方式,有jar、war、ear等
<name> 项目的名称
<url> 项目的地址
<properties> 属性配置,比如:<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dependencies> 构建项目依赖的jar
mvn archetype:generate 固定写法
-DgroupId 组织标识(包名)
-DartifactId 项目名称
-DarchetypeArtifactId 指定ArchetypeId,maven-archetype-quickstart,创建一个Java Project;maven-archetype-webapp,创建一个Web Project
-DinteractiveMode 是否使用交互模式
archetype是mvn内置的一个插件,create任务可以创建一个java项目骨架,DgroupId是软件包的名称,DartifactId是项目名,DarchetypeArtifactId是可用的mvn项目骨架,目前可以使用的骨架有:
- maven-archetype-archetype
- maven-archetype-j2ee-simple
- maven-archetype-mojo
- maven-archetype-portlet
- maven-archetype-profiles (currently under development)
- maven-archetype-quickstart
- maven-archetype-simple (currently under development)
- maven-archetype-site
- maven-archetype-site-simple
- maven-archetype-webapp
- groupId:组织标识(包名)
- artifactId:项目名称
- version:项目的当前版本
- packaging:项目的打包方式,最为常见的jar和war两种
样例:
Maven坐标是通过groupId、artifactId、version、packaging、classfier这些元素来定义的,我们来看看示例:
我们在平时的开发中一般只需要使用必要的几个元素就好了,不必要的一些元素往往是用不着的,我们来看看每个元素所代表的含义,前面也是有简单的提到过的。
groupId :定义当前Maven项目隶属的实际项目。首先,Maven项目和实际项目不一定是一对一的关系。比如SpringFrameWork这一实际项目,其对应的Maven项目会有很多,如spring-core,spring-context等。这是由于Maven中模块的概念,因此,一个实际项目往往会被划分成很多模块。其次,groupId不应该对应项目隶属的组织或公司。原因很简单,一个组织下会有很多实际项目,如果groupId只定义到组织级别,而后面我们会看到,artifactId只能定义Maven项目(模块),那么实际项目这个层次将难以定义。最后,groupId的表示方式与Java包名的表达方式类似,通常与域名反向一一对应。上例中,groupId为junit,是不是感觉很特殊,这样也是可以的,因为全世界就这么个junit,它也没有很多分支。
artifactId : 该元素定义当前实际项目中的一个Maven项目(模块),推荐的做法是使用实际项目名称作为artifactId的前缀。比如上例中的junit,junit就是实际的项目名称,方便而且直观。在默认情况下,maven生成的构件,会以artifactId作为文件头,如junit-3.8.1.jar,使用实际项目名称作为前缀,就能方便的从本地仓库找到某个项目的构件。
version : 该元素定义了使用构件的版本,如上例中junit的版本是3.8.1,你也可以改为4.0表示使用4.0版本的junit。
packaging :定义Maven项目打包的方式,使用构件的什么包。首先,打包方式通常与所生成构件的文件扩展名对应,如上例中没有packaging,则默认为jar包,最终的文件名为junit-3.8.1.jar。也可以打包成war等。
classifier: 该元素用来帮助定义构建输出的一些附件。附属构件与主构件对应,如上例中的主构件为junit-3.8.1.jar,该项目可能还会通过一些插件生成如junit-3.8.1-javadoc.jar,junit-3.8.1-sources.jar, 这样附属构件也就拥有了自己唯一的坐标。
Maven为什么使用坐标?
- Maven世界拥有大量构建,我们需要找一个用来唯一标识一个构建的统一规范。
- 拥有了统一规范,就可以把查找工作交给机器。
借鉴自:http://www.cnblogs.com/xdp-gacl/tag/Maven%E5%AD%A6%E4%B9%A0%E6%80%BB%E7%BB%93/
整理自我的印象笔记(很早之前就有学过Maven,当时笔记都做在了印象笔记,本来准备按照自己的理解重新写一系列Maven博客,但依然转载是因为一方面作者的体系已经比较全面了,锦上添花的作用不大;另一方面自己对这方面知识已了解,重新写一系列博客对自己的时间和精力是很大的浪费。所以本博客主要内容取自以上网址,中间穿插了自己的一些完善和修改,时间问题代码就不重新敲了。)主要介绍Maven基本概念。
Maven 基本概念——根目录、项目创建、坐标的更多相关文章
- Maven基本概念——根目录、项目创建、坐标
转载来自:https://www.cnblogs.com/zjfjava/p/6817793.html 尊重原创! (一)Maven 基本概念——根目录.项目创建.坐标 1. MavenProj ...
- (一)Maven 基本概念——根目录、项目创建、坐标
1. MavenProjectRoot(项目根目录) |----src | |----main | | |----java ——存放项目的.java文件 ...
- (三)创建基于maven的javaFX+springboot项目创建
创建基于maven的javaFx+springboot项目有两种方式,第一种为通过非编码的方式来设计UI集成springboot:第二种为分离用户界面(UI)和后端逻辑集成springboot,其中用 ...
- maven project module 依赖项目创建 ---转
一.创建Maven Project 1.右击 --> New --> Other,--> Maven --> Maven Project --> Next 2.如下图,选 ...
- Maven学习 五 Maven项目创建(1)jar项目
第一步:Maven项目的创建 File->new->Maven project. 点击下一步 上方的两个多选框选上,第一个是不使用archetype 原型模板,第二个是使用默认工作空间 点 ...
- Maven进价:使用m2eclipse创建web项目
1.新建Maven项目 2.设置项目空间 3.选择maven-archetype-webapp 4.填写Maven坐标 Maven坐标:groupId:artifactId:packaging:ver ...
- Maven入门,Maven项目的创建,nexus 2.x搭建私服以及Maven多模块项目创建
maven的了解做一个总结,以便日后查阅, 若有不足之处,还望指出,学无止境 当然也能起到入门效果. 一,搭建maven私服 1.工具 a. Nexus 2.5.1-01 b. Maven 3.3.9 ...
- maven学习3,如何创建一个web项目
Maven学习 (三) 使用m2eclipse创建web项目 1.首先确认你的eclipse已经安装好m2eclipse的环境,可以参照上两篇Maven学习内容 2.新建一个maven的项目 ...
- springmvc 项目完整示例09 maven项目创建
需求表均同springmvc案例 此处只是使用maven 注意,以下所有需要建立在你的eclipse等已经集成配置好了maven了,说白了就是新建项目的时候已经可以找到maven了 没有的话需要安装m ...
随机推荐
- HttpRuntime.Cache 与 HttpContext.Current.Cache
1.HttpRuntime.Cache是应用程序级别的, 2.而HttpContext.Current.Cache是针对当前WEB上下文定义的. 3.这二个都是调用的同一个对象,不同的是:HttpRu ...
- [4]Hexo静态博客背景及界面显示优化配置
示例预览:我的主页 前提预设: [3]hexo+github搭建个人博客的主题配置 [2]hexo+github搭建个人博客的简单使用 [1]hexo+github搭建个人博客的过程记录 背景图片添加 ...
- 【BZOJ4942】[NOI2017]整数(分块)
[BZOJ4942][NOI2017]整数(分块) 题面 BZOJ 洛谷 题解 暴力就是真正的暴力,直接手动模拟进位就好了. 此时复杂度是模拟的复杂度加上单次询问的\(O(1)\). 所以我们需要优化 ...
- windows配置flutter的注意点
参考官网配置:https://flutter.cn/docs/get-started/install/windows 注意点: 1. 配置好环境变量后,必须重启电脑才有效果(后面还有需要重启的,所以到 ...
- [转]全面认识golang string
作者:@apocelipes本文为作者原创,转载请注明出处:https://www.cnblogs.com/apocelipes/p/9798413.html string我们每天都在使用,可是对于s ...
- 微服务架构 ------ Ubuntu下Docker的安装
1.准备一个全新的Ubuntu环境 2.准备安装Docker及其依赖 apt-get update 更新数据源 apt-get -y install apt-transport-https ca-ce ...
- Python基础14
P73. 内嵌函数的讲解介绍 内部函数,书中讲的应用较简单,后面找篇具体的文章学习下
- 如何让SQL语句不执行默认排序,而是按照in语句的顺序返回结果
Oracle: ')order by instr('111,222,333,444,555,666',order_id); Mysql: ') order by instr(',111,222,333 ...
- day 68
目录 表单指令 条件指令 循环指令 分隔符 过滤器 计算属性 监听属性 表单指令 v-model="变量",变量值与表单标签的value相关 v-model可以实现数据的双向绑定, ...
- Removing Stones(2019年牛客多校第三场G+启发式分治)
目录 题目链接 题意 思路 代码 题目链接 传送门 题意 初始时有\(n\)堆石子,每堆石子的石子个数为\(a_i\),然后进行游戏. 游戏规则为你可以选择任意两堆石子,然后从这两堆中移除一个石子,最 ...