Search code examples
mavenspring-bootmaven-jar-plugin

Unable to build the jar with maven-jar-plugin


I am using maven-compiler-plugin 3.1 When I try to do 'Run As---> Maven install', I am getting the following error :

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar (default-jar) on project test-tom: Error assembling JAR: For artifact {org.springframework.boot:spring-boot-starter-tomcat:null:jar}: The version cannot be empty.

Solution

  • Excluded the tomcat depends from spring boot starter

    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-tomcat</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>