aQute.bnd.ant.ReleaseTask Maven / Gradle / Ivy
The newest version!
package aQute.bnd.ant;
import org.apache.tools.ant.BuildException;
import aQute.bnd.build.Project;
import aQute.bnd.build.Workspace;
/**
*
* ANT task to release into a repository, equivalent to: <bnd
* command="release"/>
*
*
* To release into the default repository (defined by
* -releaserepo
in build.bnd
):
*
*
*
* <bndrelease/>
*
*
* To release into a specific named repository:
*
*
* <bndrelease releaserepo="My Repository"/>
*
*
* @author Neil Bartlett
* @see BndTask for setup instructions.
*/
public class ReleaseTask extends BaseTask {
String releaseRepo = null;
@Override
public void execute() throws BuildException {
try {
Project project = Workspace.getProject(getProject().getBaseDir());
if (releaseRepo == null) {
project.release(false);
} else {
project.release(releaseRepo);
}
if (report(project))
throw new BuildException("Release failed");
} catch (Exception e) {
e.printStackTrace();
throw new BuildException(e);
}
}
public void setReleaserepo(String releaseRepo) {
this.releaseRepo = releaseRepo;
}
}