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;
Run an app as a job on a cluster.
 @Mojo(name = "run-app")
 public class RunAppMojo extends AbstractAppMojo {

The URL of the Oozie service to use.
   @Parameter(property = "cdk.oozieUrl", required = true)
   private String oozieUrl;

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;

Job configuration properties for the application. This provides a means to specify values for parameterized properties in Oozie applications.
   @Parameter(property = "cdk.jobProperties")
   private Properties jobProperties;
   public void execute() throws MojoExecutionExceptionMojoFailureException {
     OozieClient oozieClient = new OozieClient();
     Properties conf = oozieClient.createConfiguration();
     if ( != null) {
     if ( != null) {
       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 " +
     String appPath = getAppPath().toString();
     conf.setProperty(getAppPathPropertyName(), appPath);
     conf.setProperty(appPath); // used in coordinator.xml
     getLog().info("App path: " + appPath);
     try {
       String jobId =;
       getLog().info("Running Oozie job " + jobId);
     } catch (OozieClientException e) {
       throw new MojoExecutionException("Error running Oozie job"e);
   private String getAppPathPropertyName() {
     if ("coordinator".equals()) {
       return .;
     } else if ("bundle".equals()) {
       return .;
     } else {
      return .;
New to GrepCode? Check out our FAQ X