1 package org.apache.maven.plugins.patchtracker;
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.plugin.MojoExecutionException;
23 import org.apache.maven.plugins.patchtracker.tracking.PatchTracker;
24 import org.apache.maven.plugins.patchtracker.tracking.PatchTrackerException;
25 import org.apache.maven.plugins.patchtracker.tracking.PatchTrackerRequest;
26 import org.apache.maven.plugins.patchtracker.tracking.PatchTrackerResult;
27 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
28
29
30
31
32
33
34
35
36 public class CreatePatchMojo
37 extends AbstractPatchMojo
38 {
39
40
41 public void execute()
42 throws MojoExecutionException
43 {
44
45
46 String patchContent = getPatchContent();
47
48 PatchTrackerRequest patchTrackerRequest = buidPatchTrackerRequest( true );
49
50 patchTrackerRequest.setPatchContent( patchContent );
51
52 getLog().debug( patchTrackerRequest.toString() );
53
54 try
55 {
56 PatchTracker patchTracker = getPatchTracker();
57 PatchTrackerResult result = patchTracker.createPatch( patchTrackerRequest, getLog() );
58 getLog().info( "issue created with id:" + result.getPatchId() + ", url:" + result.getPatchUrl() );
59 }
60 catch ( ComponentLookupException e )
61 {
62 throw new MojoExecutionException( e.getMessage(), e );
63 }
64 catch ( PatchTrackerException e )
65 {
66 throw new MojoExecutionException( e.getMessage(), e );
67 }
68
69
70 }
71
72
73 }