sping boot How to hit the outer jar package into the fat jar

Source: Internet
Author: User

Personal development, there is no need to build a nexus, so for us to use Spring boot development project, we will introduce the local jar package, for example, I will build a Lib package in the root directory, and then put the local jar inside, add to the Classpath reference.

Then you will find that when we hit the jar, we were unable to package the jar under the Lib into the boot fat jar. Causes the program to fail to start. So you just follow the configuration below, configure the POM packaging plug-in is OK. (I haven't seen a few of them for a while, just need to change the pom.xml build.)

<project.basedir>d:/xxx/workspace/Project Name </project.basedir>
  <Build>        <Plugins>            <plugin>                <groupId>Org.springframework.boot</groupId>                <Artifactid>Spring-boot-maven-plugin</Artifactid>            </plugin>            <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration&                    Gt <source>1.8</source> <target>1.8</target> <encoding>ut F-8</encoding> <compilerArguments> <extdirs>${project.basedir} /lib</extdirs> </compilerArguments> </configuration> </p lugin> </plugins> <resources> <resource> <directory>${p Roject.basedir}/lib</directory> <targetPath>BOOT-INF/lib/</targetPath> &lt ;includes> <include>**/*.jar</include> </includes> </              Resource> <resource> <directory>src/main/resources</directory>  <targetPath>BOOT-INF/classes/</targetPath> </resource> </resources>     </Build>

The red font is configured in the back. Note that you have to write Boot-inf this is the directory structure inside the boot packaged jar. This will pack your local jar together. Hey! I wrote it down, and it's refreshing in the afternoon!

sping boot How to hit the outer jar package into the fat jar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.