use of org.springframework.boot.loader.tools.Libraries in project spring-boot by spring-projects.
the class BuildImageMojo method getBuildRequest.
private BuildRequest getBuildRequest(Libraries libraries) throws MojoExecutionException {
ImagePackager imagePackager = new ImagePackager(getArchiveFile(), getBackupFile());
Function<Owner, TarArchive> content = (owner) -> getApplicationContent(owner, libraries, imagePackager);
Image image = (this.image != null) ? this.image : new Image();
if (image.name == null && this.imageName != null) {
image.setName(this.imageName);
}
if (image.builder == null && this.imageBuilder != null) {
image.setBuilder(this.imageBuilder);
}
if (image.runImage == null && this.runImage != null) {
image.setRunImage(this.runImage);
}
if (image.cleanCache == null && this.cleanCache != null) {
image.setCleanCache(this.cleanCache);
}
if (image.pullPolicy == null && this.pullPolicy != null) {
image.setPullPolicy(this.pullPolicy);
}
if (image.publish == null && this.publish != null) {
image.setPublish(this.publish);
}
if (image.network == null && this.network != null) {
image.setNetwork(this.network);
}
if (image.publish != null && image.publish && publishRegistryNotConfigured()) {
throw new MojoExecutionException("Publishing an image requires docker.publishRegistry to be configured");
}
return customize(image.getBuildRequest(this.project.getArtifact(), content));
}
use of org.springframework.boot.loader.tools.Libraries in project spring-boot by spring-projects.
the class BuildImageMojo method buildImage.
private void buildImage() throws MojoExecutionException {
Libraries libraries = getLibraries(Collections.emptySet());
try {
DockerConfiguration dockerConfiguration = (this.docker != null) ? this.docker.asDockerConfiguration() : null;
BuildRequest request = getBuildRequest(libraries);
Builder builder = new Builder(new MojoBuildLog(this::getLog), dockerConfiguration);
builder.build(request);
} catch (IOException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
}
use of org.springframework.boot.loader.tools.Libraries 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());
}
Aggregations