File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\maven-plugin\src\main\java\hudson\maven\MavenArgumentInterceptorAction.java.html

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2011, Dominik Bartholdi
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson.maven;
25
26 import hudson.model.Action;
27 import hudson.util.ArgumentListBuilder;
28
29 /**
30 * Provides a hook to change the arguments passed to the maven execution. This
31 * enables plugins to transiently change the arguments of a maven build (e.g.
32 * change the arguments for a release build).
33 *
34 * @author Dominik Bartholdi (imod)
35 *
36 */
37 public interface MavenArgumentInterceptorAction extends Action {
38
39 /**
40 * Provides maven goals and options to start the build with. This is the
41 * preferred way to provide other goals then the default ones to a build.
42 * The goals and options returned by this method will not be persist and do
43 * not affect the default configuration.
44 * <p>
45 * This method will be called on one and only one action during a build. If
46 * there are two actions present in the build, the second will be ignored.
47 *
48 * @param build
49 * reference to the current build, might be used for some
50 * calculations for the correct arguments
51 * @return the maven goals and options to start maven with. Result is
52 * ignored if <code>null</code> or empty. Variables will be expanded
53 * by the caller.
54 */
55 public String getGoalsAndOptions(MavenModuleSetBuild build);
56
57 /**
58 * Change/add arguments to any needs, but special care has to be taken, as
59 * the list contains every argument needed for the default execution (e.g.
60 * <code>-f /path/to/pom.xml</code> or <code>-B</code>). <br />
61 * An easy example would be to add "<code>-DskipTests</code>" to skip the
62 * test execution on request.
63 *
64 * <p>
65 * This method is called on all present MavenArgumentInterceptorAction
66 * during a build (kind of chaining, each action can add the arguments it
67 * thinks are missing).
68 *
69 * @param mavenargs
70 * the calculated default maven arguments (never
71 * <code>null</code>).
72 * @param build
73 * reference to the current build, might be used for some
74 * calculations for the correct arguments
75 * @return the new arguments to be used.
76 */
77 public ArgumentListBuilder intercept(ArgumentListBuilder mavenargs, MavenModuleSetBuild build);
78
79 }
80