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多模块项目的更多相关文章

  1. IntelliJ Idea14 创建Maven多模块项目

    Maven多模块项目的参考资料 Sonatype上的教程 http://books.sonatype.com/mvnex-book/reference/multimodule.html 在这个教程里, ...

  2. Maven入门,Maven项目的创建,nexus 2.x搭建私服以及Maven多模块项目创建

    maven的了解做一个总结,以便日后查阅, 若有不足之处,还望指出,学无止境 当然也能起到入门效果. 一,搭建maven私服 1.工具 a. Nexus 2.5.1-01 b. Maven 3.3.9 ...

  3. eclipse导入SVN上的Maven多模块项目

    eclipse导入SVN上的Maven多模块项目 博客分类: Eclipse&MyEclipse SVN Maven   一.SVN上Maven多模块项目结构 使用eclipse导入SVN上的 ...

  4. IntelliJ IDEA中创建Web聚合项目(Maven多模块项目)

    Eclipse用多了,IntelliJ中创建Maven聚合项目可能有小伙伴还不太熟悉,我们今天就来看看. IntelliJ中创建普通的Java聚合项目相对来说比较容易,不会涉及到web操作,涉及到we ...

  5. SpringBoot+Maven多模块项目(创建、依赖、打包可执行jar包部署测试)完整流程

    一,创建Maven多模块项目先建立外层父工程         File →new →project  选择Spring Initializr          Next下一步到以下页面 工程结构如下 ...

  6. maven多模块项目构建

    描述 一个大的企业级项目通常跨越了数十万行代码,牵涉了数十或数百软件人员的努力.如果开发者在同一个项目下开   发,那么项目的管理.构建将会变得很难控制.因此设计人员会将项目划分为多个模块,多个模块独 ...

  7. Maven多模块项目加载

      Maven多模块项目中如何让Spring运行时成功加载指定的子模块   将子模块pom加入到父模块pom的定义中,并继承父模块   在web.xml中配置加载子模块的Spring配置文件   在启 ...

  8. Spring Boot 项目实战(一)Maven 多模块项目搭建

    一.前言 最近公司项目准备开始重构,框架选定为 Spring Boot ,本篇主要记录了在 IDEA 中搭建 Spring Boot Maven 多模块项目的过程. 二.软件及硬件环境 macOS S ...

  9. maven多模块项目找不到Class错误

    接手了一个maven管理的多模块项目,又是javaconfig,又是spring data jpa,还算是比较新比较正规的模块化结构吧..然后我往其中的一个模块中新添加了一个jpa的entity,然后 ...

  10. SpringBoot+Maven 多模块项目的构建、运行、打包

    SpringBoot+Maven 多模块项目的构建.运行.打包 https://blog.csdn.net/zekeTao/article/details/79413919

随机推荐

  1. Docker 入门 第四部分: Swarms

    目录 Docker 入门 第四部分: Swarms 先决条件 介绍 理解Swarm集群 部署swarm 创建一个集群 在swarm集群上部署你的app应用 为 swarm管理器配置一个docker-m ...

  2. baiduTemplate.js 百度JS模板引擎

    baiduTemplate希望创造一个用户觉得“简单好用”的JS模板引擎 先展示两个例子,然后说说对baidutemplate.js的理解,从而将这一工具加到个人百宝箱里. <script id ...

  3. C#实现虚拟控件列表显示100w个控件方法

    方法一: C#的FlowlayoutPanel添加一定数据量的控件后就会空白,通过虚拟列表方式可以解决这个问题. 1.创建一个包含ScrollPanel和滚动条的用户控件,定义一个List,添加控件时 ...

  4. FineReport: 清空(重置)条件reset()

    在使用控件时,有时我们希望能够快捷的重置控件的内容,或者重置所有控件的内容,效果如下图所示: 1.给需要重置的控件设置控件名 2.给重置按钮设置点击事件 3.点击事件中加入javascript代码 只 ...

  5. android 生成、pull解析xml文件

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools= ...

  6. centos7 网卡命名

    CentOS6 及之前以太网网卡进行顺序命名的:多网卡如:eth0,eth1 依次.Centos7 则不同,命名规则默认是基于固件.拓扑.位置信息来分配.一.网卡命名的策略systemd对网络设备的命 ...

  7. HNOI2018游记

    第一次参加本省省选,结果又是一次划水 Day 0 喝了一个小时鸡汤 大家看看人家钱学森(sheng) 竞赛生要多发展些爱好 不要一考完就fake,那种下考说"大佬AC辣!太强啦!月莫月莫月莫 ...

  8. 有关ACM学习的博客链接

    大综合: 杭电OJ水题大全题解:http://blog.csdn.net/ysc504?viewmode=contents 14级浙江财经大学大佬:http://blog.csdn.net/jtjy5 ...

  9. 【BARTS计划】【Share_Week1】社交产品思考

    Share:每周分享篇有观点和思考的技术文章   社交梦是每个互联网大厂都在做的,好像大家都默认了一种说法:没有社交功能的产品是不完整的,不做社交产品的公司是缺少战略眼光的.但就目前来看,微信的社交霸 ...

  10. UML入门[转]

    访问权限控制 class Dummy { - private field1 # protected field2 ~ package method1() + public method2() } Al ...