Package com.alexecollins.vbox.maven

Source Code of com.alexecollins.vbox.maven.CreateDefinitionMojo

package com.alexecollins.vbox.maven;

import com.alexecollins.vbox.core.task.CreateDefinition;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import java.io.File;

/**
* Create a new definition from a template. These are created in src/main/vbox.
*
* @author alexec (alex.e.c@gmail.com)
* @goal create-definition
* @phase generate-resources
* @see ListDefinitionsMojo
*/
public class CreateDefinitionMojo extends AbstractVBoxMojo {

  /**
   * The name of the template to use, e.g. "CentOS_6_5". Defaults to the name for backwards compatibility.
   *
   * @parameter property="vbox.template", default="${vbox.name}"
   */
  private String templateName;

  /**
   * The name of the template to use, e.g. "app1".
   *
   * @parameter property="vbox.name"
   * @required
   */
  private String name;

  public void execute() throws MojoExecutionException, MojoFailureException {

    try {
      new CreateDefinition(getContext(), templateName, new File(project.getBasedir(), "src/main/vbox/" + name)).call();
    } catch (Exception e) {
      throw new MojoExecutionException("failed to create definition", e);
    }
  }
}
TOP

Related Classes of com.alexecollins.vbox.maven.CreateDefinitionMojo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.