maven 打包包含lib

这篇具有很好参考价值的文章主要介绍了maven 打包包含lib。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

springboot 项目

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.1.1.RELEASE</version>
                <configuration>
                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
                    <!-- 打包 包含lib -->
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

普通maven项目文章来源地址https://www.toymoban.com/news/detail-437332.html

 <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>lib</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>*.jar</include>
                </includes>
            </resource>
        </resources>
 <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <!-- 配置编译插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerArgument>-parameters</compilerArgument>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>

            </plugin>

            <!-- 配置打包插件(设置主类,并打包成胖包) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <finalName>${project.artifactId}</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <!-- 此处,要改成自己的程序入口(即 main 函数类) -->
                        <manifest>
                            <mainClass>org.example.Application</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>lib</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>*.jar</include>
                </includes>
            </resource>
        </resources>
    </build>

到了这里,关于maven 打包包含lib的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • maven 打包包含lib

    springboot 项目 普通maven项目

    2024年02月03日
    浏览(7)
  • SpringBoot Maven 项目打包的艺术--主清单属性缺失与NoClassDefFoundError的优雅解决方案

    SpringBoot Maven 项目打包的艺术--主清单属性缺失与NoClassDefFoundError的优雅解决方案

    这两个问题的出现场景是,你打包完一个SpringBoot、Maven项目,上传Jar包到服务器运行的时候遇到的。也算是比较经典的两个问题了,如果你在打包项目的时候,很容易遇到,这篇文章就是用来一劳永逸地解决它们。 1.1、Jar包运行:没有主清单属性 解决方案 其实这个问题主要

    2024年04月14日
    浏览(11)
  • 组件打包常用工具-proguard-maven-plugin等

     1.proguard-maven-plugin 2. maven-shade-plugin 3.maven-Assembly-plugin 4.onejar-maven-plugin    5.mvaen-jar-plugin和 maven-dependency-plugin  

    2024年02月12日
    浏览(15)
  • maven 模块打包时包含依赖和打包可执行的jar

    maven 模块打包 1)maven 模块打包jar文件时,指定包含依赖(with-dependencies); 2)maven 模块打包jar文件时,指定入口MainClass、打包生成可执行的jar; vi qftools/common/src/main/java/com/xxx/qftools/common/Main.java package com.xxx.qftools.common; public class Main {     public static void main(String args[]) {    

    2024年02月14日
    浏览(23)
  • IDEA 打包报错 maven打包报错 spring-boot-maven-plugin 与spring-boot 版本的兼容性

    IDEA 打包报错 maven打包报错 spring-boot-maven-plugin 与spring-boot 版本的兼容性

    报错信息如下: org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 或者 ClassNotFoundException: org.apache.commons.compress.archivers.jar.JarArchiveEntry 解决办法: 排查打包是否使

    2024年02月15日
    浏览(43)
  • SpringBoot学习——项目用maven打包成jar包 & windows + Linux平台运行 & Linux安装java & 遇到的问题

    SpringBoot学习——项目用maven打包成jar包 & windows + Linux平台运行 & Linux安装java & 遇到的问题

    1.maven打包springboot项目,jar包; 2.windows安装java环境,以及运行jar包; 3.Linux安装java环境,以及运行jar包; 4.运行jar包template might not exist报错及解决; Maven 构建生命周期定义了一个项目构建跟发布的过程。 一个典型的 Maven 构建(build)生命周期是由以下几个阶段的序列组成的

    2024年02月16日
    浏览(55)
  • 【error】maven打包报错,Failed to execute goal org.apache.maven.plugins,idea报错找不到符号

    【error】maven打包报错,Failed to execute goal org.apache.maven.plugins,idea报错找不到符号

    error: 原因: target目录不存在或为空。 解决方案: 重新打maven包;选中项目右击 — Build Module ‘xxxx’ — 生成target文件即可;重新运行项目,不会报错了; 【error】: Some problems were encountered while building the effective model for com.ectit:rmt-service:jar:1.0-SNAPSHOT ‘build.plugins.plugin.version’

    2024年02月13日
    浏览(49)
  • Maven项目解决cannot resolve plugin maven-deploy-plugin:2.7

    Maven项目解决cannot resolve plugin maven-deploy-plugin:2.7

    导入maven项目后,编辑的时候提示一些插件加载失败!大概率是你的网络有问题,插件下载失败。 如下图:(网络突然好了,我想截图但是没有复现,用网上找到的截图代替,明白意思就行) 其余的情况也可以用同样的方式解决。 问题的原因基本上就是网络问题导致的下载

    2024年02月14日
    浏览(7)
  • Maven打包失败--Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:no found...

    Maven打包失败--Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:no found...

    1、问题还原,无论怎样操作,打包都是失败 Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.4.RELEASE:repackage (repackage) on project guigu-common: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.3.4.RELEASE:repackage failed: Unable to find main class - [Help 1] [ERROR]  2、这个问

    2024年02月03日
    浏览(47)
  • SpringBoot:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile

    SpringBoot:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile

     首先以上就是我的报错问题,我这个出现的情况就是刚刚创建一个springboot项目,还没写任何东西,刚打算运行一下,就产生了这个问题,在网上也看了很多文章,有人说可能是jdk版本和自己本地的版本不对,大家也可以试一下,先把jdk版本的地方都修改正确。但是这个对于

    2024年02月13日
    浏览(16)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包