use of com.google.cloud.tools.jib.maven.MavenProjectProperties in project jib by GoogleContainerTools.
the class SyncMapMojo method execute.
@Override
public void execute() throws MojoExecutionException {
checkJibVersion();
if (MojoCommon.shouldSkipJibExecution(this)) {
return;
}
// add check that means this is only for jars
if (!"jar".equals(getProject().getPackaging())) {
throw new MojoExecutionException("Skaffold sync is currently only available for 'jar' style Jib projects, but the packaging of " + getProject().getArtifactId() + " is '" + getProject().getPackaging() + "'");
}
// add check for exploded containerization
try {
if (!ContainerizingMode.EXPLODED.equals(ContainerizingMode.from(getContainerizingMode()))) {
throw new MojoExecutionException("Skaffold sync is currently only available for Jib projects in 'exploded' containerizing mode, but the containerizing mode of " + getProject().getArtifactId() + " is '" + getContainerizingMode() + "'");
}
} catch (InvalidContainerizingModeException ex) {
throw new MojoExecutionException("Invalid containerizing mode", ex);
}
try (TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider()) {
MavenProjectProperties projectProperties = MavenProjectProperties.getForProject(Preconditions.checkNotNull(descriptor), getProject(), getSession(), getLog(), tempDirectoryProvider, getInjectedPluginExtensions());
MavenRawConfiguration configuration = new MavenRawConfiguration(this);
try {
String syncMapJson = PluginConfigurationProcessor.getSkaffoldSyncMap(configuration, projectProperties, skaffold.sync.excludes.stream().map(File::toPath).map(Path::toAbsolutePath).collect(Collectors.toSet()));
System.out.println();
System.out.println("BEGIN JIB JSON: SYNCMAP/1");
System.out.println(syncMapJson);
} catch (Exception ex) {
throw new MojoExecutionException("Failed to generate a Jib file map for sync with Skaffold", ex);
}
}
}
use of com.google.cloud.tools.jib.maven.MavenProjectProperties in project jib by google.
the class SyncMapMojo method execute.
@Override
public void execute() throws MojoExecutionException {
checkJibVersion();
if (MojoCommon.shouldSkipJibExecution(this)) {
return;
}
// add check that means this is only for jars
if (!"jar".equals(getProject().getPackaging())) {
throw new MojoExecutionException("Skaffold sync is currently only available for 'jar' style Jib projects, but the packaging of " + getProject().getArtifactId() + " is '" + getProject().getPackaging() + "'");
}
// add check for exploded containerization
try {
if (!ContainerizingMode.EXPLODED.equals(ContainerizingMode.from(getContainerizingMode()))) {
throw new MojoExecutionException("Skaffold sync is currently only available for Jib projects in 'exploded' containerizing mode, but the containerizing mode of " + getProject().getArtifactId() + " is '" + getContainerizingMode() + "'");
}
} catch (InvalidContainerizingModeException ex) {
throw new MojoExecutionException("Invalid containerizing mode", ex);
}
try (TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider()) {
MavenProjectProperties projectProperties = MavenProjectProperties.getForProject(Preconditions.checkNotNull(descriptor), getProject(), getSession(), getLog(), tempDirectoryProvider, getInjectedPluginExtensions());
MavenRawConfiguration configuration = new MavenRawConfiguration(this);
try {
String syncMapJson = PluginConfigurationProcessor.getSkaffoldSyncMap(configuration, projectProperties, skaffold.sync.excludes.stream().map(File::toPath).map(Path::toAbsolutePath).collect(Collectors.toSet()));
System.out.println();
System.out.println("BEGIN JIB JSON: SYNCMAP/1");
System.out.println(syncMapJson);
} catch (Exception ex) {
throw new MojoExecutionException("Failed to generate a Jib file map for sync with Skaffold", ex);
}
}
}
Aggregations