1 | |
package org.apache.maven.shared.release.exec; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.shared.release.ReleaseResult; |
23 | |
import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; |
24 | |
import org.apache.maven.shared.release.env.ReleaseEnvironment; |
25 | |
import org.codehaus.plexus.logging.LogEnabled; |
26 | |
import org.codehaus.plexus.logging.Logger; |
27 | |
import org.codehaus.plexus.util.StringUtils; |
28 | |
|
29 | |
import java.io.File; |
30 | |
import java.util.ArrayList; |
31 | |
import java.util.List; |
32 | |
|
33 | |
public abstract class AbstractMavenExecutor |
34 | |
implements MavenExecutor, LogEnabled |
35 | |
{ |
36 | |
|
37 | |
private Logger logger; |
38 | |
|
39 | |
protected AbstractMavenExecutor() |
40 | 176 | { |
41 | 176 | } |
42 | |
|
43 | |
|
44 | |
public void executeGoals( File workingDirectory, String goals, boolean interactive, String additionalArguments, |
45 | |
String pomFileName, ReleaseResult result ) |
46 | |
throws MavenExecutorException |
47 | |
{ |
48 | 2 | executeGoals( workingDirectory, goals, new DefaultReleaseEnvironment(), interactive, additionalArguments, pomFileName, result ); |
49 | 2 | } |
50 | |
|
51 | |
|
52 | |
public void executeGoals( File workingDirectory, String goals, boolean interactive, String additionalArguments, |
53 | |
ReleaseResult result ) |
54 | |
throws MavenExecutorException |
55 | |
{ |
56 | 22 | executeGoals( workingDirectory, goals, new DefaultReleaseEnvironment(), interactive, additionalArguments, result ); |
57 | 18 | } |
58 | |
|
59 | |
|
60 | |
public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment, |
61 | |
boolean interactive, String arguments, ReleaseResult result ) |
62 | |
throws MavenExecutorException |
63 | |
{ |
64 | 22 | executeGoals( workingDirectory, goals, releaseEnvironment, interactive, arguments, null, result ); |
65 | 18 | } |
66 | |
|
67 | |
|
68 | |
public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment, |
69 | |
boolean interactive, String additionalArguments, String pomFileName, ReleaseResult result ) |
70 | |
throws MavenExecutorException |
71 | |
{ |
72 | 24 | List<String> goalsList = new ArrayList<String>(); |
73 | 24 | if ( goals != null ) |
74 | |
{ |
75 | |
|
76 | |
|
77 | |
|
78 | 22 | String[] tokens = StringUtils.split( goals, ", \n\r\t" ); |
79 | |
|
80 | 66 | for ( int i = 0; i < tokens.length; ++i ) |
81 | |
{ |
82 | 44 | goalsList.add( tokens[i] ); |
83 | |
} |
84 | |
} |
85 | 24 | executeGoals( workingDirectory, goalsList, releaseEnvironment, interactive, additionalArguments, pomFileName, result ); |
86 | 20 | } |
87 | |
|
88 | |
protected abstract void executeGoals( File workingDirectory, List<String> goals, ReleaseEnvironment releaseEnvironment, |
89 | |
boolean interactive, String additionalArguments, String pomFileName, ReleaseResult result ) |
90 | |
throws MavenExecutorException; |
91 | |
|
92 | |
|
93 | |
protected final Logger getLogger() |
94 | |
{ |
95 | 10 | return logger; |
96 | |
} |
97 | |
|
98 | |
|
99 | |
public void enableLogging( Logger logger ) |
100 | |
{ |
101 | 174 | this.logger = logger; |
102 | 174 | } |
103 | |
} |