use of org.jreleaser.util.JReleaserException in project jreleaser by jreleaser.
the class Discussions method getResolvedMessageTemplate.
public String getResolvedMessageTemplate(JReleaserContext context, Map<String, Object> extraProps) {
Map<String, Object> props = context.fullProps();
applyTemplates(props, getResolvedExtraProperties());
props.put(Constants.KEY_TAG_NAME, context.getModel().getRelease().getGitService().getEffectiveTagName(context.getModel()));
props.putAll(extraProps);
Path templatePath = context.getBasedir().resolve(messageTemplate);
try {
Reader reader = java.nio.file.Files.newBufferedReader(templatePath);
return applyTemplate(reader, props);
} catch (IOException e) {
throw new JReleaserException(RB.$("ERROR_unexpected_error_reading_template", context.relativizeToBasedir(templatePath)));
}
}
use of org.jreleaser.util.JReleaserException in project jreleaser by jreleaser.
the class AbstractJReleaserMojo method createContext.
protected JReleaserContext createContext() throws MojoExecutionException {
try {
if (isQuiet()) {
System.setProperty(JRELEASER_QUIET, "true");
}
JReleaserLogger logger = getLogger();
PlatformUtils.resolveCurrentPlatform(logger);
Path basedir = resolveBasedir();
logger.info("JReleaser {}", JReleaserVersion.getPlainVersion());
JReleaserVersion.banner(logger.getTracer());
if (null != configFile) {
logger.info("Configuring with {}", configFile.getAbsolutePath());
}
logger.increaseIndent();
logger.info("- basedir set to {}", basedir.toAbsolutePath());
logger.decreaseIndent();
return ContextCreator.create(logger, resolveConfigurer(configFile), getMode(), null == configFile ? convertModel() : readModel(logger), basedir, outputDirectory.toPath(), dryrun, gitRootSearch, collectSelectedPlatforms());
} catch (JReleaserException e) {
throw new MojoExecutionException("JReleaser for project " + project.getArtifactId() + " has not been properly configured.", e);
}
}
use of org.jreleaser.util.JReleaserException in project jreleaser by jreleaser.
the class JpackageResolver method resolveJpackageOutputs.
private static void resolveJpackageOutputs(JReleaserContext context, Jpackage jpackage, Errors errors) {
Path baseOutputDirectory = context.getAssembleDirectory().resolve(jpackage.getName()).resolve(jpackage.getType());
Artifact jdk = jpackage.getResolvedPlatformPackager().getJdk();
if (!context.isPlatformSelected(jdk))
return;
Jpackage.PlatformPackager packager = jpackage.getResolvedPlatformPackager();
String platform = jdk.getPlatform();
for (String type : packager.getTypes()) {
try {
Optional<Path> file = listFilesAndProcess(baseOutputDirectory, files -> files.filter(path -> path.getFileName().toString().endsWith(type)).findFirst());
if (!file.isPresent()) {
errors.assembly(RB.$("validation_missing_assembly", jpackage.getType(), jpackage.getName(), jpackage.getName()));
} else {
Artifact artifact = Artifact.of(file.get(), platform);
artifact.setExtraProperties(jpackage.getExtraProperties());
artifact.activate();
jpackage.addOutput(artifact);
}
} catch (IOException e) {
throw new JReleaserException(RB.$("ERROR_unexpected_error"), e);
}
}
}
use of org.jreleaser.util.JReleaserException in project jreleaser by jreleaser.
the class Webhook method getResolvedMessageTemplate.
public String getResolvedMessageTemplate(JReleaserContext context, Map<String, Object> extraProps) {
Map<String, Object> props = context.fullProps();
applyTemplates(props, getResolvedExtraProperties());
props.put(KEY_TAG_NAME, context.getModel().getRelease().getGitService().getEffectiveTagName(context.getModel()));
props.putAll(extraProps);
Path templatePath = context.getBasedir().resolve(messageTemplate);
try {
Reader reader = java.nio.file.Files.newBufferedReader(templatePath);
return applyTemplate(reader, props);
} catch (IOException e) {
throw new JReleaserException(RB.$("ERROR_unexpected_error_reading_template", context.relativizeToBasedir(templatePath)));
}
}
use of org.jreleaser.util.JReleaserException in project jreleaser by jreleaser.
the class Zulip method getResolvedMessageTemplate.
public String getResolvedMessageTemplate(JReleaserContext context, Map<String, Object> extraProps) {
Map<String, Object> props = context.fullProps();
applyTemplates(props, getResolvedExtraProperties());
props.put(KEY_TAG_NAME, context.getModel().getRelease().getGitService().getEffectiveTagName(context.getModel()));
props.putAll(extraProps);
Path templatePath = context.getBasedir().resolve(messageTemplate);
try {
Reader reader = java.nio.file.Files.newBufferedReader(templatePath);
return applyTemplate(reader, props);
} catch (IOException e) {
throw new JReleaserException(RB.$("ERROR_unexpected_error_reading_template", context.relativizeToBasedir(templatePath)));
}
}
Aggregations