Maven多模块项目
1.项目结构-父项目
其中parent是父项目,这个父项目的父项目是springboot,我搭建这个多模块的项目的目的主要是为了研究学习springbatch

父项目的pom文件内容:
<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/maven-v4_0_0.xsd"> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.8.RELEASE</version>
</parent> <modelVersion>4.0.0</modelVersion>
<groupId>com.wx.onepass</groupId>
<artifactId>onepass-parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>onepass-parent</name> <modules>
<module>onepass-dependencies</module>
<module>onepass-test</module>
<module>onepass-batch</module>
<module>onepass-web</module>
</modules> <properties>
<!-- 依赖包版本号 -->
<junit.version>3.8.1</junit.version>
<spring-boot-legacy.version>1.1.0.RELEASE</spring-boot-legacy.version>
</properties> <dependencyManagement>
<dependencies>
<!-- junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency> </dependencies>
</dependencyManagement> <dependencies>
<!-- 引入spring-boot-starter-web,因为我需要它提供的web功能,具体有哪些功能目前还没有仔细查过-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 将starter-web中默认的tomcat替换成jetty -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies> <build>
<finalName>onepass</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<!-- 指定source和target的版本 -->
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
2.项目结构-子项目
之前一直没有搞懂一件事情,就是这样的多模块有父有子的项目,其中的子模块是否需要配置相互的依赖,比如web中需要依赖batch,需要需要在web模块的dependencies中配置对batch的依赖。现在我很明确了是需要的。下面以web项目的pom文件为例
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.wx.onepass</groupId>
<artifactId>onepass-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../onepass-parent</relativePath>
</parent>
<artifactId>onepass-web</artifactId>
<packaging>war</packaging>
<name>onepass-web Maven Webapp</name> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.wx.onepass</groupId>
<artifactId>onepass-batch</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>onepass-web</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<!-- 指定source和target的版本 -->
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

3.Maven Depedencies里面依赖的子模块什么时候是JAR包,什么时候是项目文件夹
从上图可以看出,onepass-batch是以jar包的形式存在其中的,猜想这是因为我对parent已经做了clean install,如果没有做这一步,应该onepass-batch应该是文件夹,猜想,还没有验证,验证了再来更新
Maven多模块项目的更多相关文章
- IntelliJ Idea14 创建Maven多模块项目
Maven多模块项目的参考资料 Sonatype上的教程 http://books.sonatype.com/mvnex-book/reference/multimodule.html 在这个教程里, ...
- Maven入门,Maven项目的创建,nexus 2.x搭建私服以及Maven多模块项目创建
maven的了解做一个总结,以便日后查阅, 若有不足之处,还望指出,学无止境 当然也能起到入门效果. 一,搭建maven私服 1.工具 a. Nexus 2.5.1-01 b. Maven 3.3.9 ...
- eclipse导入SVN上的Maven多模块项目
eclipse导入SVN上的Maven多模块项目 博客分类: Eclipse&MyEclipse SVN Maven 一.SVN上Maven多模块项目结构 使用eclipse导入SVN上的 ...
- IntelliJ IDEA中创建Web聚合项目(Maven多模块项目)
Eclipse用多了,IntelliJ中创建Maven聚合项目可能有小伙伴还不太熟悉,我们今天就来看看. IntelliJ中创建普通的Java聚合项目相对来说比较容易,不会涉及到web操作,涉及到we ...
- SpringBoot+Maven多模块项目(创建、依赖、打包可执行jar包部署测试)完整流程
一,创建Maven多模块项目先建立外层父工程 File →new →project 选择Spring Initializr Next下一步到以下页面 工程结构如下 ...
- maven多模块项目构建
描述 一个大的企业级项目通常跨越了数十万行代码,牵涉了数十或数百软件人员的努力.如果开发者在同一个项目下开 发,那么项目的管理.构建将会变得很难控制.因此设计人员会将项目划分为多个模块,多个模块独 ...
- Maven多模块项目加载
Maven多模块项目中如何让Spring运行时成功加载指定的子模块 将子模块pom加入到父模块pom的定义中,并继承父模块 在web.xml中配置加载子模块的Spring配置文件 在启 ...
- Spring Boot 项目实战(一)Maven 多模块项目搭建
一.前言 最近公司项目准备开始重构,框架选定为 Spring Boot ,本篇主要记录了在 IDEA 中搭建 Spring Boot Maven 多模块项目的过程. 二.软件及硬件环境 macOS S ...
- maven多模块项目找不到Class错误
接手了一个maven管理的多模块项目,又是javaconfig,又是spring data jpa,还算是比较新比较正规的模块化结构吧..然后我往其中的一个模块中新添加了一个jpa的entity,然后 ...
- SpringBoot+Maven 多模块项目的构建、运行、打包
SpringBoot+Maven 多模块项目的构建.运行.打包 https://blog.csdn.net/zekeTao/article/details/79413919
随机推荐
- Spring+quartz 实现定时任务job集群配置【原】
为什么要有集群定时任务? 因为如果多server都触发相同任务,又同时执行,那在99%的场景都是不适合的.比如银行每晚24:00都要汇总营业额.像下面3台server同时进行汇总,最终计算结果可能是真 ...
- ELF文件解析(二):ELF header详解
上一篇讲了ELF文件的总体布局,以及section和segment的概念.按照计划,今天继续讲 ELF header. 讲新的内容之前,先更正一个错误:上一篇中讲section header tabl ...
- buildroot构建项目(五)--- u-boot 2017.11 适配开发板修改 3 ---- 系统启动初始化之二
一.cpu_init_crit 当执行完时钟初始化后,程序执行: bl cpu_init_crit 跳转到CPU初始化处进行,在其中主要是执行 caches 的关闭 和 MMU的关闭,之后跳转到 ...
- 51nod1331 狭窄的通道
题目传送门 这道题 51nod只Ac了十二个人 没有题解可以研究 所以就自己YY了半天 在这里先感谢一波岚清大爷 orz 然后这道题我分了两种情况 一种是左边的往左跑右边的往右跑 中间有一部分直接走不 ...
- string字符串js操作
String 对象方法 方法 描述 anchor() 创建 HTML 锚. big() 用大号字体显示字符串. blink() 显示闪动字符串. bold() 使用粗体显示字符串. charAt() ...
- Java SE 之 数据库操作工具类(DBUtil)设计
JDBC创建数据库基本连接 //1.加载驱动程序 Class.forName(driveName); //2.获得数据库连接 Connection connection = DriverManager ...
- vue axios全攻略
不再继续维护vue-resource,并推荐大家使用 axios 开始,axios 被越来越多的人所了解.本来想在网上找找详细攻略,突然发现,axios 的官方文档本身就非常详细!!有这个还要什么自行 ...
- 解决bootstrap-table多次请求只触发一次的问题
在初始化table之前,要将table销毁,否则会保留上次加载的内容 1 $("#table").bootstrapTable('destroy'); 2 $("#tab ...
- Debian Linux Error “Driver 'pcspkr' is already registered, aborting...”
问题: Error: Driver ‘pcspkr’ is already registered, aborting… 解决: [root@reistlin.com ~]# echo "bl ...
- 简单透彻理解JSONP原理及使用
首先提一下JSON这个概念,JSON是一种轻量级的数据传输格式,被广泛应用于当前Web应用中.JSON格式数据的编码和解析基本在所有主流语言中都被实现,所以现在大部分前后端分离的架构都以JSON格式进 ...