use of org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Writer in project sling by apache.
the class AttachPartialBundleListMojo method execute.
public void execute() throws MojoExecutionException, MojoFailureException {
final BundleList initializedBundleList;
if (bundleListFile.exists()) {
try {
initializedBundleList = readBundleList(bundleListFile);
} catch (IOException e) {
throw new MojoExecutionException("Unable to read bundle list file", e);
} catch (XmlPullParserException e) {
throw new MojoExecutionException("Unable to read bundle list file", e);
}
} else {
throw new MojoFailureException(String.format("Bundle list file %s does not exist.", bundleListFile.getAbsolutePath()));
}
interpolateProperties(initializedBundleList, this.project, this.mavenSession);
final BundleListXpp3Writer writer = new BundleListXpp3Writer();
try {
this.bundleListOutput.getParentFile().mkdirs();
writer.write(new FileWriter(bundleListOutput), initializedBundleList);
} catch (IOException e) {
throw new MojoExecutionException("Unable to write bundle list", e);
}
// if this project is a partial bundle list, it's the main artifact
if (project.getPackaging().equals(PARTIAL)) {
project.getArtifact().setFile(bundleListOutput);
} else {
// otherwise attach it as an additional artifact
projectHelper.attachArtifact(project, TYPE, CLASSIFIER, bundleListOutput);
}
this.getLog().info("Attaching bundle list configuration");
try {
this.attachConfigurations();
} catch (final IOException ioe) {
throw new MojoExecutionException("Unable to attach configuration.", ioe);
} catch (final ArchiverException ioe) {
throw new MojoExecutionException("Unable to attach configuration.", ioe);
}
}
Aggregations