Search in sources :

Example 1 with ContainerizingMode

use of com.google.cloud.tools.jib.plugins.common.ContainerizingMode in project jib by GoogleContainerTools.

the class GradleProjectProperties method createJibContainerBuilder.

@Override
public JibContainerBuilder createJibContainerBuilder(JavaContainerBuilder javaContainerBuilder, ContainerizingMode containerizingMode) {
    try {
        FileCollection projectDependencies = project.files(project.getConfigurations().getByName(configurationName).getResolvedConfiguration().getResolvedArtifacts().stream().filter(artifact -> artifact.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier).map(ResolvedArtifact::getFile).collect(Collectors.toList()));
        if (isWarProject()) {
            String warFilePath = getWarFilePath();
            log(LogEvent.info("WAR project identified, creating WAR image from: " + warFilePath));
            Path explodedWarPath = tempDirectoryProvider.newDirectory();
            ZipUtil.unzip(Paths.get(warFilePath), explodedWarPath);
            return JavaContainerBuilderHelper.fromExplodedWar(javaContainerBuilder, explodedWarPath, projectDependencies.getFiles().stream().map(File::getName).collect(Collectors.toSet()));
        }
        SourceSet mainSourceSet = getMainSourceSet();
        FileCollection classesOutputDirectories = mainSourceSet.getOutput().getClassesDirs().filter(File::exists);
        Path resourcesOutputDirectory = mainSourceSet.getOutput().getResourcesDir().toPath();
        FileCollection allFiles = project.getConfigurations().getByName(configurationName).filter(File::exists);
        FileCollection nonProjectDependencies = allFiles.minus(classesOutputDirectories).minus(projectDependencies).filter(file -> !file.toPath().equals(resourcesOutputDirectory));
        FileCollection snapshotDependencies = nonProjectDependencies.filter(file -> file.getName().contains("SNAPSHOT"));
        FileCollection dependencies = nonProjectDependencies.minus(snapshotDependencies);
        // Adds dependency files
        javaContainerBuilder.addDependencies(dependencies.getFiles().stream().map(File::toPath).collect(Collectors.toList())).addSnapshotDependencies(snapshotDependencies.getFiles().stream().map(File::toPath).collect(Collectors.toList())).addProjectDependencies(projectDependencies.getFiles().stream().map(File::toPath).collect(Collectors.toList()));
        switch(containerizingMode) {
            case EXPLODED:
                // Adds resource files
                if (Files.exists(resourcesOutputDirectory)) {
                    javaContainerBuilder.addResources(resourcesOutputDirectory);
                }
                // Adds class files
                for (File classesOutputDirectory : classesOutputDirectories) {
                    javaContainerBuilder.addClasses(classesOutputDirectory.toPath());
                }
                if (classesOutputDirectories.isEmpty()) {
                    log(LogEvent.warn("No classes files were found - did you compile your project?"));
                }
                break;
            case PACKAGED:
                // Add a JAR
                Jar jarTask = (Jar) project.getTasks().findByName("jar");
                Path jarPath = jarTask.getArchiveFile().get().getAsFile().toPath();
                log(LogEvent.debug("Using JAR: " + jarPath));
                javaContainerBuilder.addToClasspath(jarPath);
                break;
            default:
                throw new IllegalStateException("unknown containerizing mode: " + containerizingMode);
        }
        return javaContainerBuilder.toContainerBuilder();
    } catch (IOException ex) {
        throw new GradleException("Obtaining project build output files failed", ex);
    }
}
Also used : JavaContainerBuilderHelper(com.google.cloud.tools.jib.plugins.common.JavaContainerBuilderHelper) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) ImageReference(com.google.cloud.tools.jib.api.ImageReference) SingleThreadedExecutor(com.google.cloud.tools.jib.plugins.common.logging.SingleThreadedExecutor) ProgressEvent(com.google.cloud.tools.jib.event.events.ProgressEvent) PropertyNames(com.google.cloud.tools.jib.plugins.common.PropertyNames) JavaContainerBuilder(com.google.cloud.tools.jib.api.JavaContainerBuilder) TimerEventHandler(com.google.cloud.tools.jib.plugins.common.TimerEventHandler) Task(org.gradle.api.Task) Provider(org.gradle.api.provider.Provider) TaskProvider(org.gradle.api.tasks.TaskProvider) Locale(java.util.Locale) Duration(java.time.Duration) Path(java.nio.file.Path) Verify(com.google.common.base.Verify) Project(org.gradle.api.Project) Predicate(java.util.function.Predicate) ServiceLoader(java.util.ServiceLoader) TimerEvent(com.google.cloud.tools.jib.event.events.TimerEvent) InvalidImageReferenceException(com.google.cloud.tools.jib.api.InvalidImageReferenceException) PluginExtensionLogger(com.google.cloud.tools.jib.plugins.common.PluginExtensionLogger) Collectors(java.util.stream.Collectors) JavaVersion(org.gradle.api.JavaVersion) ZipUtil(com.google.cloud.tools.jib.plugins.common.ZipUtil) ContainerizingMode(com.google.cloud.tools.jib.plugins.common.ContainerizingMode) ProjectProperties(com.google.cloud.tools.jib.plugins.common.ProjectProperties) List(java.util.List) ProgressDisplayGenerator(com.google.cloud.tools.jib.plugins.common.logging.ProgressDisplayGenerator) Optional(java.util.Optional) ContainerBuildPlan(com.google.cloud.tools.jib.api.buildplan.ContainerBuildPlan) ConsoleLogger(com.google.cloud.tools.jib.plugins.common.logging.ConsoleLogger) NullExtension(com.google.cloud.tools.jib.plugins.extension.NullExtension) JibContainerBuilder(com.google.cloud.tools.jib.api.JibContainerBuilder) WarPlugin(org.gradle.api.plugins.WarPlugin) JibPluginExtensionException(com.google.cloud.tools.jib.plugins.extension.JibPluginExtensionException) Supplier(java.util.function.Supplier) FileCollection(org.gradle.api.file.FileCollection) Logger(org.gradle.api.logging.Logger) ArrayList(java.util.ArrayList) SourceSet(org.gradle.api.tasks.SourceSet) ExtensionConfiguration(com.google.cloud.tools.jib.plugins.common.RawConfiguration.ExtensionConfiguration) TempDirectoryProvider(com.google.cloud.tools.jib.filesystem.TempDirectoryProvider) Nullable(javax.annotation.Nullable) ConsoleLoggerBuilder(com.google.cloud.tools.jib.plugins.common.logging.ConsoleLoggerBuilder) Action(org.gradle.api.Action) Files(java.nio.file.Files) JavaPluginConvention(org.gradle.api.plugins.JavaPluginConvention) ResolvedArtifact(org.gradle.api.artifacts.ResolvedArtifact) Jar(org.gradle.jvm.tasks.Jar) DirectoryWalker(com.google.cloud.tools.jib.filesystem.DirectoryWalker) IOException(java.io.IOException) ProgressEventHandler(com.google.cloud.tools.jib.event.progress.ProgressEventHandler) File(java.io.File) LogEvent(com.google.cloud.tools.jib.api.LogEvent) Os(org.apache.tools.ant.taskdefs.condition.Os) Containerizer(com.google.cloud.tools.jib.api.Containerizer) JibGradlePluginExtension(com.google.cloud.tools.jib.gradle.extension.JibGradlePluginExtension) Paths(java.nio.file.Paths) GradleException(org.gradle.api.GradleException) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Path(java.nio.file.Path) SourceSet(org.gradle.api.tasks.SourceSet) ResolvedArtifact(org.gradle.api.artifacts.ResolvedArtifact) GradleException(org.gradle.api.GradleException) Jar(org.gradle.jvm.tasks.Jar) IOException(java.io.IOException) FileCollection(org.gradle.api.file.FileCollection) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) File(java.io.File)

Example 2 with ContainerizingMode

use of com.google.cloud.tools.jib.plugins.common.ContainerizingMode in project jib by google.

the class MavenProjectProperties method createJibContainerBuilder.

@Override
public JibContainerBuilder createJibContainerBuilder(JavaContainerBuilder javaContainerBuilder, ContainerizingMode containerizingMode) throws IOException {
    try {
        if (isWarProject()) {
            Path war = getWarArtifact();
            Path explodedWarPath = tempDirectoryProvider.newDirectory();
            ZipUtil.unzip(war, explodedWarPath);
            return JavaContainerBuilderHelper.fromExplodedWar(javaContainerBuilder, explodedWarPath, getProjectDependencies().stream().map(Artifact::getFile).map(File::getName).collect(Collectors.toSet()));
        }
        switch(containerizingMode) {
            case EXPLODED:
                // Add resources, and classes
                Path classesOutputDirectory = Paths.get(project.getBuild().getOutputDirectory());
                // Don't use Path.endsWith(), since Path works on path elements.
                Predicate<Path> isClassFile = path -> path.getFileName().toString().endsWith(".class");
                javaContainerBuilder.addResources(classesOutputDirectory, isClassFile.negate()).addClasses(classesOutputDirectory, isClassFile);
                break;
            case PACKAGED:
                // Add a JAR
                javaContainerBuilder.addToClasspath(getJarArtifact());
                break;
            default:
                throw new IllegalStateException("unknown containerizing mode: " + containerizingMode);
        }
        // Classify and add dependencies
        Map<LayerType, List<Path>> classifiedDependencies = classifyDependencies(project.getArtifacts(), getProjectDependencies());
        javaContainerBuilder.addDependencies(Preconditions.checkNotNull(classifiedDependencies.get(LayerType.DEPENDENCIES)));
        javaContainerBuilder.addSnapshotDependencies(Preconditions.checkNotNull(classifiedDependencies.get(LayerType.SNAPSHOT_DEPENDENCIES)));
        javaContainerBuilder.addProjectDependencies(Preconditions.checkNotNull(classifiedDependencies.get(LayerType.PROJECT_DEPENDENCIES)));
        return javaContainerBuilder.toContainerBuilder();
    } catch (IOException ex) {
        throw new IOException("Obtaining project build output files failed; make sure you have " + (isPackageErrorMessage(containerizingMode) ? "packaged" : "compiled") + " your project " + "before trying to build the image. (Did you accidentally run \"mvn clean " + "jib:build\" instead of \"mvn clean " + (isPackageErrorMessage(containerizingMode) ? "package" : "compile") + " jib:build\"?)", ex);
    }
}
Also used : Path(java.nio.file.Path) JibMavenPluginExtension(com.google.cloud.tools.jib.maven.extension.JibMavenPluginExtension) JavaContainerBuilderHelper(com.google.cloud.tools.jib.plugins.common.JavaContainerBuilderHelper) ImageReference(com.google.cloud.tools.jib.api.ImageReference) SingleThreadedExecutor(com.google.cloud.tools.jib.plugins.common.logging.SingleThreadedExecutor) ProgressEvent(com.google.cloud.tools.jib.event.events.ProgressEvent) PropertyNames(com.google.cloud.tools.jib.plugins.common.PropertyNames) JavaContainerBuilder(com.google.cloud.tools.jib.api.JavaContainerBuilder) LayerType(com.google.cloud.tools.jib.api.JavaContainerBuilder.LayerType) TimerEventHandler(com.google.cloud.tools.jib.plugins.common.TimerEventHandler) MavenProject(org.apache.maven.project.MavenProject) Duration(java.time.Duration) Map(java.util.Map) Artifact(org.apache.maven.artifact.Artifact) Path(java.nio.file.Path) Verify(com.google.common.base.Verify) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Set(java.util.Set) ServiceLoader(java.util.ServiceLoader) TimerEvent(com.google.cloud.tools.jib.event.events.TimerEvent) InvalidImageReferenceException(com.google.cloud.tools.jib.api.InvalidImageReferenceException) PluginExtensionLogger(com.google.cloud.tools.jib.plugins.common.PluginExtensionLogger) Collectors(java.util.stream.Collectors) ZipUtil(com.google.cloud.tools.jib.plugins.common.ZipUtil) ContainerizingMode(com.google.cloud.tools.jib.plugins.common.ContainerizingMode) ProjectProperties(com.google.cloud.tools.jib.plugins.common.ProjectProperties) List(java.util.List) ProgressDisplayGenerator(com.google.cloud.tools.jib.plugins.common.logging.ProgressDisplayGenerator) Optional(java.util.Optional) ContainerBuildPlan(com.google.cloud.tools.jib.api.buildplan.ContainerBuildPlan) ConsoleLogger(com.google.cloud.tools.jib.plugins.common.logging.ConsoleLogger) NullExtension(com.google.cloud.tools.jib.plugins.extension.NullExtension) PluginExecution(org.apache.maven.model.PluginExecution) JibContainerBuilder(com.google.cloud.tools.jib.api.JibContainerBuilder) HashMap(java.util.HashMap) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Build(org.apache.maven.model.Build) JibPluginExtensionException(com.google.cloud.tools.jib.plugins.extension.JibPluginExtensionException) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) ExtensionConfiguration(com.google.cloud.tools.jib.plugins.common.RawConfiguration.ExtensionConfiguration) Os(org.apache.maven.shared.utils.Os) PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) TempDirectoryProvider(com.google.cloud.tools.jib.filesystem.TempDirectoryProvider) Nullable(javax.annotation.Nullable) ConsoleLoggerBuilder(com.google.cloud.tools.jib.plugins.common.logging.ConsoleLoggerBuilder) MavenSession(org.apache.maven.execution.MavenSession) Files(java.nio.file.Files) DirectoryWalker(com.google.cloud.tools.jib.filesystem.DirectoryWalker) IOException(java.io.IOException) ProgressEventHandler(com.google.cloud.tools.jib.event.progress.ProgressEventHandler) Log(org.apache.maven.plugin.logging.Log) File(java.io.File) LogEvent(com.google.cloud.tools.jib.api.LogEvent) Plugin(org.apache.maven.model.Plugin) Containerizer(com.google.cloud.tools.jib.api.Containerizer) Paths(java.nio.file.Paths) Preconditions(com.google.common.base.Preconditions) VisibleForTesting(com.google.common.annotations.VisibleForTesting) LayerType(com.google.cloud.tools.jib.api.JavaContainerBuilder.LayerType) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException) File(java.io.File)

Example 3 with ContainerizingMode

use of com.google.cloud.tools.jib.plugins.common.ContainerizingMode in project jib by google.

the class GradleProjectProperties method createJibContainerBuilder.

@Override
public JibContainerBuilder createJibContainerBuilder(JavaContainerBuilder javaContainerBuilder, ContainerizingMode containerizingMode) {
    try {
        FileCollection projectDependencies = project.files(project.getConfigurations().getByName(configurationName).getResolvedConfiguration().getResolvedArtifacts().stream().filter(artifact -> artifact.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier).map(ResolvedArtifact::getFile).collect(Collectors.toList()));
        if (isWarProject()) {
            String warFilePath = getWarFilePath();
            log(LogEvent.info("WAR project identified, creating WAR image from: " + warFilePath));
            Path explodedWarPath = tempDirectoryProvider.newDirectory();
            ZipUtil.unzip(Paths.get(warFilePath), explodedWarPath);
            return JavaContainerBuilderHelper.fromExplodedWar(javaContainerBuilder, explodedWarPath, projectDependencies.getFiles().stream().map(File::getName).collect(Collectors.toSet()));
        }
        SourceSet mainSourceSet = getMainSourceSet();
        FileCollection classesOutputDirectories = mainSourceSet.getOutput().getClassesDirs().filter(File::exists);
        Path resourcesOutputDirectory = mainSourceSet.getOutput().getResourcesDir().toPath();
        FileCollection allFiles = project.getConfigurations().getByName(configurationName).filter(File::exists);
        FileCollection nonProjectDependencies = allFiles.minus(classesOutputDirectories).minus(projectDependencies).filter(file -> !file.toPath().equals(resourcesOutputDirectory));
        FileCollection snapshotDependencies = nonProjectDependencies.filter(file -> file.getName().contains("SNAPSHOT"));
        FileCollection dependencies = nonProjectDependencies.minus(snapshotDependencies);
        // Adds dependency files
        javaContainerBuilder.addDependencies(dependencies.getFiles().stream().map(File::toPath).collect(Collectors.toList())).addSnapshotDependencies(snapshotDependencies.getFiles().stream().map(File::toPath).collect(Collectors.toList())).addProjectDependencies(projectDependencies.getFiles().stream().map(File::toPath).collect(Collectors.toList()));
        switch(containerizingMode) {
            case EXPLODED:
                // Adds resource files
                if (Files.exists(resourcesOutputDirectory)) {
                    javaContainerBuilder.addResources(resourcesOutputDirectory);
                }
                // Adds class files
                for (File classesOutputDirectory : classesOutputDirectories) {
                    javaContainerBuilder.addClasses(classesOutputDirectory.toPath());
                }
                if (classesOutputDirectories.isEmpty()) {
                    log(LogEvent.warn("No classes files were found - did you compile your project?"));
                }
                break;
            case PACKAGED:
                // Add a JAR
                Jar jarTask = (Jar) project.getTasks().findByName("jar");
                Path jarPath = jarTask.getArchiveFile().get().getAsFile().toPath();
                log(LogEvent.debug("Using JAR: " + jarPath));
                javaContainerBuilder.addToClasspath(jarPath);
                break;
            default:
                throw new IllegalStateException("unknown containerizing mode: " + containerizingMode);
        }
        return javaContainerBuilder.toContainerBuilder();
    } catch (IOException ex) {
        throw new GradleException("Obtaining project build output files failed", ex);
    }
}
Also used : JavaContainerBuilderHelper(com.google.cloud.tools.jib.plugins.common.JavaContainerBuilderHelper) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) ImageReference(com.google.cloud.tools.jib.api.ImageReference) SingleThreadedExecutor(com.google.cloud.tools.jib.plugins.common.logging.SingleThreadedExecutor) ProgressEvent(com.google.cloud.tools.jib.event.events.ProgressEvent) PropertyNames(com.google.cloud.tools.jib.plugins.common.PropertyNames) JavaContainerBuilder(com.google.cloud.tools.jib.api.JavaContainerBuilder) TimerEventHandler(com.google.cloud.tools.jib.plugins.common.TimerEventHandler) Task(org.gradle.api.Task) Provider(org.gradle.api.provider.Provider) TaskProvider(org.gradle.api.tasks.TaskProvider) Locale(java.util.Locale) Duration(java.time.Duration) Path(java.nio.file.Path) Verify(com.google.common.base.Verify) Project(org.gradle.api.Project) Predicate(java.util.function.Predicate) ServiceLoader(java.util.ServiceLoader) TimerEvent(com.google.cloud.tools.jib.event.events.TimerEvent) InvalidImageReferenceException(com.google.cloud.tools.jib.api.InvalidImageReferenceException) PluginExtensionLogger(com.google.cloud.tools.jib.plugins.common.PluginExtensionLogger) Collectors(java.util.stream.Collectors) JavaVersion(org.gradle.api.JavaVersion) ZipUtil(com.google.cloud.tools.jib.plugins.common.ZipUtil) ContainerizingMode(com.google.cloud.tools.jib.plugins.common.ContainerizingMode) ProjectProperties(com.google.cloud.tools.jib.plugins.common.ProjectProperties) List(java.util.List) ProgressDisplayGenerator(com.google.cloud.tools.jib.plugins.common.logging.ProgressDisplayGenerator) Optional(java.util.Optional) ContainerBuildPlan(com.google.cloud.tools.jib.api.buildplan.ContainerBuildPlan) ConsoleLogger(com.google.cloud.tools.jib.plugins.common.logging.ConsoleLogger) NullExtension(com.google.cloud.tools.jib.plugins.extension.NullExtension) JibContainerBuilder(com.google.cloud.tools.jib.api.JibContainerBuilder) WarPlugin(org.gradle.api.plugins.WarPlugin) JibPluginExtensionException(com.google.cloud.tools.jib.plugins.extension.JibPluginExtensionException) Supplier(java.util.function.Supplier) FileCollection(org.gradle.api.file.FileCollection) Logger(org.gradle.api.logging.Logger) ArrayList(java.util.ArrayList) SourceSet(org.gradle.api.tasks.SourceSet) ExtensionConfiguration(com.google.cloud.tools.jib.plugins.common.RawConfiguration.ExtensionConfiguration) TempDirectoryProvider(com.google.cloud.tools.jib.filesystem.TempDirectoryProvider) Nullable(javax.annotation.Nullable) ConsoleLoggerBuilder(com.google.cloud.tools.jib.plugins.common.logging.ConsoleLoggerBuilder) Action(org.gradle.api.Action) Files(java.nio.file.Files) JavaPluginConvention(org.gradle.api.plugins.JavaPluginConvention) ResolvedArtifact(org.gradle.api.artifacts.ResolvedArtifact) Jar(org.gradle.jvm.tasks.Jar) DirectoryWalker(com.google.cloud.tools.jib.filesystem.DirectoryWalker) IOException(java.io.IOException) ProgressEventHandler(com.google.cloud.tools.jib.event.progress.ProgressEventHandler) File(java.io.File) LogEvent(com.google.cloud.tools.jib.api.LogEvent) Os(org.apache.tools.ant.taskdefs.condition.Os) Containerizer(com.google.cloud.tools.jib.api.Containerizer) JibGradlePluginExtension(com.google.cloud.tools.jib.gradle.extension.JibGradlePluginExtension) Paths(java.nio.file.Paths) GradleException(org.gradle.api.GradleException) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Path(java.nio.file.Path) SourceSet(org.gradle.api.tasks.SourceSet) ResolvedArtifact(org.gradle.api.artifacts.ResolvedArtifact) GradleException(org.gradle.api.GradleException) Jar(org.gradle.jvm.tasks.Jar) IOException(java.io.IOException) FileCollection(org.gradle.api.file.FileCollection) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) File(java.io.File)

Example 4 with ContainerizingMode

use of com.google.cloud.tools.jib.plugins.common.ContainerizingMode in project jib by google.

the class MavenProjectPropertiesTest method testCreateContainerBuilder_exceptionMessageHasPackageSuggestionIfProjectIsWar.

@Test
public void testCreateContainerBuilder_exceptionMessageHasPackageSuggestionIfProjectIsWar() throws IOException {
    String expectedMessage = "Obtaining project build output files failed; make sure you have " + "packaged your project before trying to build the image. (Did you accidentally run \"mvn clean " + "jib:build\" instead of \"mvn clean package jib:build\"?)";
    when(mockMavenProject.getPackaging()).thenReturn("war");
    when(mockTempDirectoryProvider.newDirectory()).thenThrow(IOException.class);
    for (ContainerizingMode containerizingMode : ContainerizingMode.values()) {
        IOException thrownException = assertThrows(IOException.class, () -> mavenProjectProperties.createJibContainerBuilder(mockJavaContainerBuilder, containerizingMode));
        assertThat(thrownException).hasMessageThat().isEqualTo(expectedMessage);
    }
}
Also used : IOException(java.io.IOException) ContainerizingMode(com.google.cloud.tools.jib.plugins.common.ContainerizingMode) Test(org.junit.Test)

Example 5 with ContainerizingMode

use of com.google.cloud.tools.jib.plugins.common.ContainerizingMode in project jib by GoogleContainerTools.

the class MavenProjectPropertiesTest method testCreateContainerBuilder_exceptionMessageHasPackageSuggestionIfProjectIsWar.

@Test
public void testCreateContainerBuilder_exceptionMessageHasPackageSuggestionIfProjectIsWar() throws IOException {
    String expectedMessage = "Obtaining project build output files failed; make sure you have " + "packaged your project before trying to build the image. (Did you accidentally run \"mvn clean " + "jib:build\" instead of \"mvn clean package jib:build\"?)";
    when(mockMavenProject.getPackaging()).thenReturn("war");
    when(mockTempDirectoryProvider.newDirectory()).thenThrow(IOException.class);
    for (ContainerizingMode containerizingMode : ContainerizingMode.values()) {
        IOException thrownException = assertThrows(IOException.class, () -> mavenProjectProperties.createJibContainerBuilder(mockJavaContainerBuilder, containerizingMode));
        assertThat(thrownException).hasMessageThat().isEqualTo(expectedMessage);
    }
}
Also used : IOException(java.io.IOException) ContainerizingMode(com.google.cloud.tools.jib.plugins.common.ContainerizingMode) Test(org.junit.Test)

Aggregations

ContainerizingMode (com.google.cloud.tools.jib.plugins.common.ContainerizingMode)6 IOException (java.io.IOException)6 Containerizer (com.google.cloud.tools.jib.api.Containerizer)4 ImageReference (com.google.cloud.tools.jib.api.ImageReference)4 InvalidImageReferenceException (com.google.cloud.tools.jib.api.InvalidImageReferenceException)4 JavaContainerBuilder (com.google.cloud.tools.jib.api.JavaContainerBuilder)4 JibContainerBuilder (com.google.cloud.tools.jib.api.JibContainerBuilder)4 LogEvent (com.google.cloud.tools.jib.api.LogEvent)4 ContainerBuildPlan (com.google.cloud.tools.jib.api.buildplan.ContainerBuildPlan)4 ProgressEvent (com.google.cloud.tools.jib.event.events.ProgressEvent)4 TimerEvent (com.google.cloud.tools.jib.event.events.TimerEvent)4 ProgressEventHandler (com.google.cloud.tools.jib.event.progress.ProgressEventHandler)4 DirectoryWalker (com.google.cloud.tools.jib.filesystem.DirectoryWalker)4 TempDirectoryProvider (com.google.cloud.tools.jib.filesystem.TempDirectoryProvider)4 JavaContainerBuilderHelper (com.google.cloud.tools.jib.plugins.common.JavaContainerBuilderHelper)4 PluginExtensionLogger (com.google.cloud.tools.jib.plugins.common.PluginExtensionLogger)4 ProjectProperties (com.google.cloud.tools.jib.plugins.common.ProjectProperties)4 PropertyNames (com.google.cloud.tools.jib.plugins.common.PropertyNames)4 ExtensionConfiguration (com.google.cloud.tools.jib.plugins.common.RawConfiguration.ExtensionConfiguration)4 TimerEventHandler (com.google.cloud.tools.jib.plugins.common.TimerEventHandler)4