javaspringmavenspring-bootspring-boot-maven-plugin

Spring Boot Maven Plugin - rename original JAR


When I build my project using the Spring Boot Maven Plugin I get two jar files: foo.jar and foo.jar.original. I understand that I can use fileName to call the repackaged one something else, but what I want to do is rename the original file. I want foo.jar (repackaged) and original-foo.jar (original) because I want it to be clear which one is the original, but I need the file to be .jar to work with a pipeline tool. How can I do this?


Solution

  • The .original suffix is hard-coded in org.springframework.boot.loader.tools.Repackager.getBackupFile() method so you won't be able to replace it with a original- prefix unless you fork your own version of Spring Boot Maven Plugin:

    /**
     * Return the {@link File} to use to backup the original source.
     * @return the file to use to backup the original source
     */
    public final File getBackupFile() {
        return new File(this.source.getParentFile(), this.source.getName() + ".original");
    }