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
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.
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
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.
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.
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.
Try mvn install
before running spring-boot:repackage
:
mvn clean install spring-boot:repackage