in src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorAttachMojo.java [75:112]
public void execute() throws MojoExecutionException {
if (pomPackagingOnly && !"pom".equals(project.getPackaging())) {
// https://issues.apache.org/jira/browse/MSITE-597
getLog().info("Skipping because packaging '" + project.getPackaging() + "' is not pom.");
return;
}
boolean attachedSiteDescriptor = false;
for (Locale locale : getLocales()) {
File descriptorFile = siteTool.getSiteDescriptor(siteDirectory, locale);
if (descriptorFile.exists()) {
attachedSiteDescriptor = true;
// Calculate the classifier to use
String classifier = getClassifier(descriptorFile);
// Prepare a file for the interpolated site descriptor
String filename = project.getArtifactId() + "-" + project.getVersion() + "-" + descriptorFile.getName();
File targetDescriptorFile = new File(project.getBuild().getDirectory(), filename);
try {
// Copy the site descriptor to a file
FileUtils.copyFile(descriptorFile, targetDescriptorFile);
// Attach the site descriptor
getLog().info("Attaching '"
+ PathTool.getRelativeFilePath(basedir.getAbsolutePath(), descriptorFile.getAbsolutePath())
+ "' site descriptor with classifier '" + classifier + "'.");
projectHelper.attachArtifact(project, "xml", classifier, targetDescriptorFile);
} catch (IOException e) {
throw new MojoExecutionException("Unable to copy site descriptor", e);
}
}
}
if (!attachedSiteDescriptor) {
getLog().info("No site descriptor found: nothing to attach.");
}
}