} finally {
out.close();
}
Resource resource = new Resource();
resource.setDirectory(targetDir.getPath());
resource.addInclude(pluginMetadataFileName);
getProject().getResources().add(resource);
//also attach plugin metadata as an additional artifact, like the pom
projectHelper.attachArtifact(getProject(), "plugin-metadata", targetFile);
} catch (Exception e) {
throw new MojoExecutionException("Could not create plugin metadata", e);