1 | |
package org.apache.maven.shared.release.phase; |
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.scm.manager.NoSuchScmProviderException; |
23 | |
import org.apache.maven.scm.provider.ScmProvider; |
24 | |
import org.apache.maven.scm.repository.ScmRepository; |
25 | |
import org.apache.maven.scm.repository.ScmRepositoryException; |
26 | |
import org.apache.maven.shared.release.ReleaseExecutionException; |
27 | |
import org.apache.maven.shared.release.ReleaseFailureException; |
28 | |
import org.apache.maven.shared.release.config.ReleaseDescriptor; |
29 | |
import org.apache.maven.shared.release.env.ReleaseEnvironment; |
30 | |
import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; |
31 | |
import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 196 | public abstract class AbstractReleasePomsPhase extends AbstractReleasePhase |
39 | |
{ |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
private ScmRepositoryConfigurator scmRepositoryConfigurator; |
46 | |
|
47 | |
protected ScmRepository getScmRepository( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment ) |
48 | |
throws ReleaseFailureException, ReleaseExecutionException |
49 | |
{ |
50 | |
try |
51 | |
{ |
52 | 94 | return scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, releaseEnvironment.getSettings() ); |
53 | |
} |
54 | 2 | catch ( ScmRepositoryException exception ) |
55 | |
{ |
56 | 2 | throw new ReleaseScmRepositoryException( exception.getMessage(), exception.getValidationMessages() ); |
57 | |
} |
58 | 2 | catch ( NoSuchScmProviderException exception ) |
59 | |
{ |
60 | 2 | throw new ReleaseExecutionException( "Unable to configure SCM repository: " + exception.getMessage(), |
61 | |
exception ); |
62 | |
} |
63 | |
} |
64 | |
|
65 | |
protected ScmProvider getScmProvider( ScmRepository scmRepository ) |
66 | |
throws ReleaseExecutionException |
67 | |
{ |
68 | |
try |
69 | |
{ |
70 | 56 | return scmRepositoryConfigurator.getRepositoryProvider( scmRepository ); |
71 | |
} |
72 | 0 | catch ( NoSuchScmProviderException exception ) |
73 | |
{ |
74 | 0 | throw new ReleaseExecutionException( "Unable to configure SCM repository: " + exception.getMessage(), |
75 | |
exception ); |
76 | |
} |
77 | |
} |
78 | |
} |