Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage failed: Source must refer to an existing file

前端 未结 6 499
予麋鹿
予麋鹿 2020-12-23 16:32

This is my first project using Spring (and I\'m not too experienced with Maven either) and I get the error in the title when running mvn package.

This i

相关标签:
6条回答
  • 2020-12-23 17:13

    Ok, I found the error. I needed to change the packaging parameter to jar from pom. Also, the repositories, pluginRepositories, the maven-compiler-plugin and the spring-boot-maven-plugin's version and executions weren't needed.

    0 讨论(0)
  • 2020-12-23 17:15

    I added to the pom.xml this configuration

    <plugins>
     <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
     </plugin>
    .
    .
    .
    </plugins>
    
    

    Source

    0 讨论(0)
  • 2020-12-23 17:17

    The exact error message in my case was this one:

    Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.14.RELEASE:repackage invalid entry size (expected 1 but got 0 bytes)

    I was about to create an empty clean Spring Boot project and wanted to build it, to see if everything was good. I found out that error was caused by the presence of en empty application.properties file. It was created but there was no any text in it. After I added a property (example, server.port: 19999), the project was built successfully.

    0 讨论(0)
  • If you are using intelliJ community, nothing listed will work. I switched to Eclipse and was able to run a spring project with the default settings from start.spring.io with while making no changes to the POM file or any settings. It seems intelliJ community makes a confusing mess out of spring projects.

    In short try another IDE before going through with any changes. The start.spring.io setup should work as its packaged.

    0 讨论(0)
  • 2020-12-23 17:20

    Just adding my experience :

    After none of the suggested solutions worked. I figured out there was some issue with the downloaded spring-boot-maven-plugin in the .m2 folder. Deleting the plugin and allowing the "mvn clean install" to re-download and build worked.

    0 讨论(0)
  • 2020-12-23 17:26

    Try mvn install before running spring-boot:repackage:

    mvn clean install spring-boot:repackage
    
    0 讨论(0)
提交回复
热议问题