use of org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException in project docker-maven-plugin by fabric8io.
the class DockerAssemblyManager method createAssemblyArchive.
private void createAssemblyArchive(AssemblyConfiguration assemblyConfig, MojoParameters params, BuildDirs buildDirs) throws MojoExecutionException {
DockerAssemblyConfigurationSource source = new DockerAssemblyConfigurationSource(params, buildDirs, assemblyConfig);
Assembly assembly = getAssemblyConfig(assemblyConfig, source);
AssemblyMode buildMode = assemblyConfig.getMode();
File originalArtifactFile = null;
try {
originalArtifactFile = ensureThatArtifactFileIsSet(params.getProject());
assembly.setId("docker");
assemblyArchiver.createArchive(assembly, assemblyConfig.getName(), buildMode.getExtension(), source, false);
} catch (ArchiveCreationException | AssemblyFormattingException e) {
String error = "Failed to create assembly for docker image " + " (with mode '" + buildMode + "'): " + e.getMessage() + ".";
if (params.getProject().getArtifact().getFile() == null) {
error += " If you include the build artifact please ensure that you have " + "built the artifact before with 'mvn package' (should be available in the target/ dir). " + "Please see the documentation (section \"Assembly\") for more information.";
}
throw new MojoExecutionException(error, e);
} catch (InvalidAssemblerConfigurationException e) {
throw new MojoExecutionException(assembly, "Assembly is incorrectly configured: " + assembly.getId(), "Assembly: " + assembly.getId() + " is not configured correctly: " + e.getMessage());
} finally {
setArtifactFile(params.getProject(), originalArtifactFile);
}
}
Aggregations