Al Grant
Al Grant

Reputation: 2374

Spring-boot deployment error : java.lang.IllegalStateException: Failed to get nested archive

I am trying to deploy a spring-boot application on Ubuntu 16 computer.

The application runs fine from Intellij. The build tool is gradle.

The headline error is:

java - jar assessment-0.0.1-SNAPSHOT.jar nz.org.assessment.Application
Exception in thread "main" java.lang.IllegalStateException Failed to get nested archive for entry BOOT-INF/lib/root-7.1.3.pom

The build.gradle is:

buildscript {
ext {
    springBootVersion = '2.0.3.RELEASE'
}
repositories {
    maven {
        url("https://plugins.gradle.org/m2/")
    }
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'application'

mainClassName = "nz.org.assessment.Application"

group = 'nz.org.assessment'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    maven {
        url("https://plugins.gradle.org/m2/")
    }
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-mail')

    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    compile('org.springframework.boot:spring-boot-starter-validation')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.session:spring-session-core')
    runtime('org.springframework.boot:spring-boot-devtools')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('org.springframework.security:spring-security-test')
    compile group: 'org.thymeleaf', name: 'thymeleaf', version: '3.0.9.RELEASE'

    compile group: 'org.jsoup', name: 'jsoup', version: '1.11.2'

    compile group: 'commons-io', name: 'commons-io', version: '2.6'

    compile 'org.springframework.boot:spring-boot-starter-data-jpa'
    compile 'mysql:mysql-connector-java'
    }

The code runs fine from within the IDE.

The deployed code is in a lib folder with separate jars. I have run the 'distZip' task from gradle menu in Intellij.

Upvotes: 1

Views: 1248

Answers (1)

Al Grant
Al Grant

Reputation: 2374

The solution was that spring-boot 2 onwards uses different gradle plugin. To build a executeable jar I needed to use bootJar.

https://guides.gradle.org/building-spring-boot-2-projects-with-gradle/

Upvotes: 1

Related Questions