Spring_boot the solution of jar package and packing error

Source: Internet
Author: User
Tags stack trace

Problem Generation and resolution

for those who have just taken over spring_boot, may feel very dazed, see the book written spring_boot is packaged directly into a jar package, using Java-jar * run. But I don't know how to pack it. The Spring_boot packaging plugin will be installed in the Pom file after the Spring_boot is created and we will see several options as follows:

    • The contents of the Pom file are as follows:
<?XML version= "1.0" encoding= "UTF-8"?><Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelversion>4.0.0</modelversion>    <groupId>Com.penglei</groupId>    <Artifactid>Springboot_1</Artifactid>    <version>0.0.1-snapshot</version>    <Packaging>Jar</Packaging>    <name>Spring_boot_practice_1</name>    <Description>Demo Project for Spring Boot</Description>    <Parent>        <groupId>Org.springframework.boot</groupId>        <Artifactid>Spring-boot-starter-parent</Artifactid>        <version>1.4.3.RELEASE</version>        <RelativePath/> <!--Lookup parent from repository -    </Parent>    <Properties>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>        <java.version>1.8</java.version>    </Properties>    <Dependencies>        <Dependency>            <groupId>Org.springframework.boot</groupId>            <Artifactid>Spring-boot-starter-web</Artifactid>        </Dependency>        <Dependency>            <groupId>Org.springframework.boot</groupId>            <Artifactid>Spring-boot-starter-test</Artifactid>            <Scope>Test</Scope>        </Dependency>    </Dependencies>    <Build>        <Plugins>            <plugin>                <groupId>Org.springframework.boot</groupId>                <Artifactid>Spring-boot-maven-plugin</Artifactid>            </plugin>        </Plugins>    </Build>    <repositories>        <Repository>            <ID>Spring-snapshots</ID>            <URL>Http://repo.spring.io/snapshot</URL>            <Snapshots>                <enabled>True</enabled>            </Snapshots>        </Repository>        <Repository>            <ID>Spring-milestones</ID>            <URL>Http://repo.spring.io/milestone</URL>        </Repository>    </repositories>    <pluginrepositories>        <pluginrepository>            <ID>Spring-snapshots</ID>            <URL>Http://repo.spring.io/snapshot</URL>        </pluginrepository>        <pluginrepository>            <ID>Spring-milestones</ID>            <URL>Http://repo.spring.io/milestone</URL>        </pluginrepository>    </pluginrepositories></Project>
    • On the right side of idea we'll look at the following options

If we click Repackage directly at this point, the following error will appear when packaging:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.3.release:repackage (DEFAULT-CLI) on Project Springboot_1:execution Default-cli of goal Org.springframework.boot:spring-boot-maven-plugin:1.4.3.release: Repackage Failed:source must refer to an existing file--[Help 1]
[ERROR]
[ERROR] The full stack trace of the errors, re-run Maven with THE-E switch.
[ERROR] Re-run Maven using The-x switch to enable full debug logging.
[ERROR]
[ERROR] For more information on the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Process finished with exit code 1

The proper packaging method is:

Use the MAVEN Package command directly to complete packaging, and if you have new additions, you can use the Spring-boot-maven-plugin Repackage command. Detailed steps such as:

Conclusion

If you need more information about technical articles, please continue to follow the white scholar's blog
Personal website: http://penglei.top/
Github:https://github.com/whitescholars
Weibo: http://weibo.com/u/3034107691?refer_flag=1001030102_&is_all=1

Spring_boot the solution to the jar package and packaging errors

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.