用idea打包
Posted zhangshitong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用idea打包相关的知识,希望对你有一定的参考价值。
idea的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"> <parent> <artifactId>ciems-service-operation-management</artifactId> <groupId>com.gdtnx</groupId> <version>1.0.0-Alpha</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>ciems-om-biz</artifactId> <properties> <start-class>cn.com.gdt.ciems.om.biz.OmApplication</start-class> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>com.gdtnx</groupId> <artifactId>ciems-spring-boot-starter</artifactId> <version>1.0.1-Alpha</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>${mybatis-plus.version}</version> </dependency> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> </dependency> <dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.2</version> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.10</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.14</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <dependency> <groupId>com.gdtnx</groupId> <artifactId>ks-api</artifactId> <version>0.0.1-Alpha</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>${start-class}</mainClass> </configuration> <executions> <execution> <goals> <!--可以把依赖的包都打包到生成的Jar包中--> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
红色字体为打包必须依赖的:
如果是该包上传到自己的私服那么需要在pom.xml文件中加入:
<distributionManagement> <repository> <id>nexus-releases</id> <name>Nexus Release Repository</name> <url>http://192.168.2.211:10890/nexus/content/repositories/releases/</url> </repository> </distributionManagement>
接下来,在idea里打包,如果是maven父子模块项目,那么在打包时为了防止子模块之间的依赖关系,需要打包父模块的pom.xml文件,具体方式见下图:ciems-service-operation-management就是父模块
以上是关于用idea打包的主要内容,如果未能解决你的问题,请参考以下文章