idea新建聚合项目并附上标签的详细过程
首先新建父工程
新建spring boot项目
填写项目信息
指定该子项目的路径
如果是组件类型的子项目 可以删除application.xml和启动类
父工程pom文件
<?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"> <modelVersion>4.0.0</modelVersion> <groupId>com.demo</groupId> <artifactId>project</artifactId> <version>1.0.0-SNAPSHOT</version> <properties> <spring-boot.version>2.3.5.RELEASE</spring-boot.version> </properties> <modules> <module>common-mail</module> </modules> <packaging>pom</packaging> <dependencyManagement> <dependencies> <dependency> <groupId>com.xx</groupId> <artifactId>common-assembly</artifactId> <version>${vanpeng.version}</version> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- swagger --> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-annotations</artifactId> <version>1.5.10</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> </plugins> </build> </project>
<modules>:为包含的子工程artifactId名
<properties>:指常量 一般为版本号 方便统一修改
<dependencyManagement>:指定子工程有相同jar包时,使用父工程的版本号,而子工程不用在额外指定
<dependencies>:为父子工程可以同时引入的jar包
子工程pom文件
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.demo</groupId> <artifactId>project</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> <groupId>com.demo</groupId> <artifactId>common-assembly</artifactId> <version>1.0.0-SNAPSHOT</version> <properties> <java.version>1.8</java.version> <spring-cloud.version>Hoxton.SR8</spring-cloud.version> </properties> <dependencies> <!-- 此处可以引入其他子工程包 --> <dependency> <groupId>com.demo</groupId> <artifactId>common-resource</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <finalName>common-assembly-1.0.0-SNAPSHOT</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <includeSystemScope>true</includeSystemScope> <mainClass>com.demo.assembly.BusinessApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
<parent>:为父工程的信息 也就是父工程pom中的groupId,artifactId 必填 <build>:为打包时的配置
注意com.vanpeng.assembly.BusinessApplication一定要配置 否则jar包启动会找不到主函数 pom也必须配置 这是在父子工程中必须配置的 意思是 需要以方式引入 而不是打成jar
到此这篇关于idea新建聚合项目并附上标签详解的文章就介绍到这了,更多相关idea新建聚合项目内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
Spring Security 在 Spring Boot 中的使用详解【集中式】
这篇文章主要介绍了Spring Security 在 Spring Boot 中的使用【集中式】,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2020-10-10idea为java程序添加启动参数的问题解析(program arguments,vm arguments,Envi
这篇文章主要介绍了idea为java程序添加启动参数的问题解析(program arguments,vm arguments,Environment variable)并在程序中获取使用,本文给大家分享问题描述及解决方法,需要的朋友可以参考下2023-09-09spring cloud中Feign导入jar失败的问题及解决方案
这篇文章主要介绍了spring cloud中Feign导入jar失败的问题及解决方案,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2022-03-03spring boot activiti工作流的搭建与简单使用
这篇文章主要给大家介绍了关于spring boot activiti工作流的搭建与简单使用的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2018-08-08
最新评论