Copy copy = new Copy();
copy.setProject(getProject());
copy.setPreserveLastModified(true);
Echo echo = new Echo();
echo.setProject(getProject());
final File organisationDirectory = getOrganisationDirectory();
for (ArtifactOutput artifactOutput : ads) {
File targetFile = artifactOutput.getOutputLocation(organisationDirectory, false);
copy.setFile(artifactOutput.getSrcFile());
copy.setTofile(targetFile);
copy.execute();
copy.init();
if (artifactOutput.getSourceSrcFile() != null) {
File targetSourceFile = artifactOutput.getOutputLocation(organisationDirectory, true);
copy.setFile(artifactOutput.getSourceSrcFile());
copy.setTofile(targetSourceFile);
copy.execute();
copy.init();
}
String pomText = "<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" +
"<modelVersion>4.0.0</modelVersion>\n" +
"<groupId>" + artifactOutput.getOrganisation() +
"</groupId>\n" +
"<artifactId>" + artifactOutput.getArtifact() +
"</artifactId>\n" +
"<version>" + artifactOutput.getVersion() +
"</version>\n" +
"</project>";
File pomFile = artifactOutput.getOutputLocation(organisationDirectory, ".pom");
echo.setFile(pomFile);
echo.addText(pomText);
echo.execute();
}
}