Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.5K
Views
Spring Boot 2.5.0 generates plain.jar file. Can I remove it?

After the Spring Boot 2.5.0 update, it generates the myprogram-0.0.1-plain.jar file alongside the usual myprogram-0.0.1.jar. Can I disallow gradle to generate the *.plain.jar file? I use Gradle 7.0.2.

What I get:

build/
  libs/
    myprogram-0.0.1.jar
    myprogram-0.0.1-plain.jar

What I want:

build/
  libs/
    myprogram-0.0.1.jar

build.gradle:

plugins {
    id 'org.springframework.boot' version '2.5.0'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

over 4 years ago · Santiago Trujillo
4 answers
Answer question

0

It was a change in Spring Boot 2.5.0.

As @ThomasKläger pointed out: You can set it in the build.gradle configuration.

build.gradle

jar {
    enabled = false
}

For Kotlin devs:

tasks.getByName<Jar>("jar") {
    enabled = false
}

Alternatively, you can run the bootJar task. It produces only the default runnable jar.

over 4 years ago · Santiago Trujillo Report

0

try use follow setting:

jar {
   enabled = true
   archiveClassifier = '' //use empty string
}

because org.springframework.boot.gradle.plugin.JavaPluginAction.java

        private void classifyJarTask(Project project) {
    project.getTasks().named(JavaPlugin.JAR_TASK_NAME, Jar.class)
            .configure((task) -> task.getArchiveClassifier().convention("plain"));
}

from spring-boot-gradle-plugin sources file: https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/2.5.0/spring-boot-gradle-plugin-2.5.0-sources.jar

see:
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveClassifier

over 4 years ago · Santiago Trujillo Report

0

This gradle config will produce myprogram-0.0.1.jar instead of myprogram-0.0.1-plain.jar

In your build.gradle.kts

// Build executable jar
tasks.jar {
    enabled = true
    // Remove `plain` postfix from jar file name
    archiveClassifier.set("")
}
over 4 years ago · Santiago Trujillo Report

0

Instead of using the build gradle task you could use bootJar. That will only build the bootable jar.

Keep in mind that bootJar won't run your tests before building.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!