p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 12.0px "Helvetica Neue"; color: #454545 }
span.s1 { font: 12.0px ".PingFang SC" }
1,设置编译版本为jdk 1.8
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build>
2 maven排除依赖jar包中的子jar
<dependency>? <groupId>com.xx.xx</groupId>? <artifactId>xx</artifactId>? <version>${xx.version}</version>? <exclusions>? <exclusion>? <groupId>org.springframework</groupId>? <artifactId>*</artifactId>? </exclusion>?</exclusions> </dependency>
3,将maven将java项目依赖包一起打入一个jar包内需要的配置
<plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass></mainClass> </manifest> </archive> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
打包的命令: 在项目的目录下的命令行输入:mvn clean package
原文地址:https://www.cnblogs.com/yanyuechao/p/8372874.html
时间: 2024-10-06 01:56:08