2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.maven.plugin;
11 import java.util.ArrayList;
12 import java.util.List;
14 import org.apache.maven.plugin.MojoExecutionException;
15 import org.apache.maven.plugin.MojoFailureException;
16 import org.apache.maven.plugins.annotations.LifecyclePhase;
17 import org.apache.maven.plugins.annotations.Mojo;
22 @Mojo( name = "stop", defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST )
23 public class StopControllerMojo extends AbstractControllerMojo {
24 private static final boolean SKIP_STOP = Boolean.getBoolean("skipControllerStop");
27 public void start() throws MojoExecutionException, MojoFailureException {
29 getLog().info("Controller STOP is skipped per configuration " +
30 "(-DskipControllerStop=true).");
34 List<String> args = new ArrayList<String>();
36 Process proc = invokeScript(args, null);
38 int status = proc.waitFor();
40 getLog().info("Controller stopped.");
42 getLog().error("Error stopping controller. See stdout log for details.");
44 } catch (InterruptedException ie) {
45 throw new MojoExecutionException("Error stopping controller : " + ie.getMessage());
48 getLog().info("Controller not running.");
50 // cleanup for any hung processes