Search in sources :

Example 1 with Repackager

use of org.springframework.boot.loader.tools.Repackager in project spring-boot by spring-projects.

the class RepackageMojo method getRepackager.

private Repackager getRepackager(File source) {
    Repackager repackager = new Repackager(source, this.layoutFactory);
    repackager.addMainClassTimeoutWarningListener(new LoggingMainClassTimeoutWarningListener());
    repackager.setMainClass(this.mainClass);
    if (this.layout != null) {
        getLog().info("Layout: " + this.layout);
        repackager.setLayout(this.layout.layout());
    }
    return repackager;
}
Also used : Repackager(org.springframework.boot.loader.tools.Repackager)

Example 2 with Repackager

use of org.springframework.boot.loader.tools.Repackager in project spring-boot by spring-projects.

the class MyBuildTool method build.

public void build() throws IOException {
    File sourceJarFile = /**/
    null;
    Repackager repackager = new Repackager(sourceJarFile);
    repackager.setBackupSource(false);
    repackager.repackage(this::getLibraries);
}
Also used : Repackager(org.springframework.boot.loader.tools.Repackager) File(java.io.File)

Example 3 with Repackager

use of org.springframework.boot.loader.tools.Repackager in project spring-boot by spring-projects.

the class RepackageMojo method repackage.

private void repackage() throws MojoExecutionException {
    Artifact source = getSourceArtifact(this.classifier);
    File target = getTargetFile(this.finalName, this.classifier, this.outputDirectory);
    Repackager repackager = getRepackager(source.getFile());
    Libraries libraries = getLibraries(this.requiresUnpack);
    try {
        LaunchScript launchScript = getLaunchScript();
        repackager.repackage(target, libraries, launchScript, parseOutputTimestamp());
    } catch (IOException ex) {
        throw new MojoExecutionException(ex.getMessage(), ex);
    }
    updateArtifact(source, target, repackager.getBackupFile());
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) Repackager(org.springframework.boot.loader.tools.Repackager) Libraries(org.springframework.boot.loader.tools.Libraries) LaunchScript(org.springframework.boot.loader.tools.LaunchScript) DefaultLaunchScript(org.springframework.boot.loader.tools.DefaultLaunchScript) IOException(java.io.IOException) File(java.io.File) Artifact(org.apache.maven.artifact.Artifact)

Aggregations

Repackager (org.springframework.boot.loader.tools.Repackager)3 File (java.io.File)2 IOException (java.io.IOException)1 Artifact (org.apache.maven.artifact.Artifact)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 DefaultLaunchScript (org.springframework.boot.loader.tools.DefaultLaunchScript)1 LaunchScript (org.springframework.boot.loader.tools.LaunchScript)1 Libraries (org.springframework.boot.loader.tools.Libraries)1