use of org.apache.maven.project.MavenProjectHelper in project maven-plugins by apache.
the class AttachArtifactTask method execute.
/** {@inheritDoc} */
public void execute() {
if (file == null) {
throw new BuildException("File is a required parameter.");
}
if (!file.exists()) {
throw new BuildException("File does not exist: " + file);
}
if (this.getProject().getReference(mavenProjectRefId) == null) {
throw new BuildException("Maven project reference not found: " + mavenProjectRefId);
}
if (type == null) {
type = FileUtils.getExtension(file.getName());
}
MavenProject mavenProject = ((MavenAntRunProject) this.getProject().getReference(mavenProjectRefId)).getMavenProject();
if (this.getProject().getReference(mavenProjectHelperRefId) == null) {
throw new BuildException("Maven project helper reference not found: " + mavenProjectHelperRefId);
}
log("Attaching " + file + " as an attached artifact", Project.MSG_VERBOSE);
MavenProjectHelper projectHelper = (MavenProjectHelper) getProject().getReference(mavenProjectHelperRefId);
projectHelper.attachArtifact(mavenProject, type, classifier, file);
}
Aggregations