1.无jar包
<build>
<finalName>ZhiFou-1.0-SNAPSHOT</finalName><!-- 导出jar的名字 -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>{Mainclass}</mainClass>
<!-- 主类的位置,例如上图文件,主类配置应为: -->
<mainClass>com.example.zhifou.Main.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
2.有jar包
(1)首先引入依赖,lib包与src同级目录
<!--引入本地lib目录下的jar包-->
<dependency>
<groupId>wx</groupId>
<artifactId>wx</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/wx-1.0-jar-with-dependencies.jar</systemPath>
</dependency>
(2)在build中设置资源
<resources>
<resource>
<directory>lib</directory>
<targetPath>BOOT-INF/lib</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<!--(猜测xml可以不设置,未试验) -->
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
3.先到项目下先cmd运行测试再挂到服务器上
标签:src,java,lib,jar,1.0,wx From: https://www.cnblogs.com/yzjBlog123123/p/17001310.html