springboot 导入自定义jar包 maven无法打包 运行无主清单问题

版权声明:转载请声明原文出处!!!! https://blog.csdn.net/weixin_40461281/article/details/83148461

如果导入了自定义jar包,如下格式

        <dependency>
            <groupId>com.alipay.demo</groupId>
            <artifactId>trade</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/alipay-trade-sdk-1.0.0.jar</systemPath>
        </dependency>

则打包不能通过正常方式打包

如要在pom.xml做如下配置

    <build>
        <finalName>XXXXXXXXX包名</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
                    <fork>true</fork>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <!-- 自定义jar包存放路径 -->
                <directory>src/main/webapp/WEB-INF/lib</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
            <resource>
                <!-- 代码所在路径 -->
                <directory>src/main</directory>
                <targetPath>BOOT-INF/classes/</targetPath>
            </resource>
        </resources>
    </build>

接着使用 maven-package 工具打包

等待打包成功即可

猜你喜欢

转载自blog.csdn.net/weixin_40461281/article/details/83148461