Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2013 Cloudera Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package com.cloudera.cdk.maven.plugins;
 import java.util.List;
 import  org.apache.hadoop.fs.Path;
 import static org.twdata.maven.mojoexecutor.MojoExecutor.*;

Package an application on the local filesystem.
 @Mojo(name = "package-app", defaultPhase = .,
     requiresDependencyResolution = .)
 public class PackageAppMojo extends AbstractAppMojo {

The tool class to run. The specified class must have a standard Java main method.
   @Parameter(property = "cdk.toolClass", required = true)
   private String toolClass;

Arguments to pass to the tool, in addition to those generated by addDependenciesToDistributedCache and hadoopConfiguration.
   @Parameter(property = "cdk.args")
   private String[] args;

Whether to add dependencies in the runtime classpath to Hadoop's distributed cache so that they are added to the classpath for MapReduce tasks (via -libjars).
   @Parameter(property = "cdk.addDependenciesToDistributedCache",
       defaultValue = "true")
   private boolean addDependenciesToDistributedCache;

Hadoop configuration properties.
   @Parameter(property = "cdk.hadoopConfiguration")
   private Properties hadoopConfiguration;

The type of the application (workflow, coordination, or bundle).
   // TODO: support applications which are more than one type
   @Parameter(property = "cdk.applicationType",
       defaultValue = "workflow")
   private String applicationType;

Whether the workflow.xml should be generated or not.
   @Parameter(property = "cdk.generateWorkflowXml", defaultValue = "true")
   private boolean generateWorkflowXml = true;

Character encoding for the auto-generated workflow file.
   @Parameter(property = "cdk.workflowFileEncoding", defaultValue = "UTF-8")
   private String encoding;

The version of the Oozie workflow schema.
   @Parameter(property = "cdk.schemaVersion", defaultValue = "0.4")
   private String schemaVersion;

The name of the workflow.
  @Parameter(property = "cdk.workflowName", defaultValue = "${}")
  private String workflowName;

The coordinator.xml file to use (only for applications of type coordinator).
  @Parameter(property = "cdk.coordinatorFile",
      defaultValue = "${basedir}/src/main/oozie/coordinator.xml")
  private File coordinatorFile;
  public void execute() throws MojoExecutionExceptionMojoFailureException {
    try {
      String buildDirectory = .getBuild().getDirectory();
          new File(buildDirectory + "/assembly/oozie-app.xml"));
    } catch (IOException e) {
      throw new MojoExecutionException("Error copying assembly"e);
    if () {
      File outputDir = new File(.getBuild().getDirectory(), );
      File workflowXml = new File(outputDir"workflow.xml");
      String hadoopFs = .getProperty("");
      if (hadoopFs == null) {
        throw new MojoExecutionException("Missing property '' in " +
      String hadoopJobTracker = .getProperty("mapred.job.tracker");
      if (hadoopJobTracker == null) {
        throw new MojoExecutionException("Missing property 'mapred.job.tracker' in " +
      List<Path> libJars = new ArrayList<Path>();
        File lib = new File(outputDir"lib");
        Collection<Filedeps = FileUtils.listFiles(libnew String[]{"jar"}, false);
        for (File dep : deps) {
          Path libJarPath = new Path(new Path(getAppPath(), "lib"), dep.getName());
          libJarPath = new Path(hadoopFslibJarPath);
      Workflow workflow = new Workflow(workflowXml,
      WorkflowXmlWriter workflowXmlWriter = new WorkflowXmlWriter();
    if ("coordinator".equals()) {
      File outputDir = new File(.getBuild().getDirectory(), );
      File coordinatorXml = new File(outputDir"coordinator.xml");
      try {
      } catch (IOException e) {
        throw new MojoExecutionException("Error copying coordinator file"e);
New to GrepCode? Check out our FAQ X