idea-项目整体打Jar包

1、项目整体打包

在这里插入图片描述

2.选择Main-class具有主函数的类

在这里插入图片描述

3.MANIFEST-INF/MANIFEST.MF

(记住文件位置,一般为默认,再次打包时需要替换)
完成后通过Build Artifacts才能完成打包,
在这里插入图片描述

4.此时项目会多出classes文件

在这里插入图片描述

5.用好压打开jar包找到META-INF文件夹

在其MANIFEST.MF可能没有Mian-class(函数入口)
在其添加Main-Class: com.zres.product.trs.kafka.consumer.KafkaConsumerUtil(记住“:”符号后有个空格)

可能出现的问题:

1、spring打包这几个可能内容会覆盖
在这里插入图片描述
解决办法:通过spring打包替换spring.jar资源将其覆盖。
2、其次mevan项目有些jar包是本地手动导入的,须在pom里添加

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
        <encoding>UTF-8</encoding>
        <compilerArguments>
            <extdirs>src\main\webapp\WEB-INF\lib</extdirs>
        </compilerArguments>
    </configuration>
</plugin>

将其jar包一起随打包,
运行即可。bingo~~~~~~~~~~~

Guess you like

Origin blog.csdn.net/qq_41239465/article/details/121559122