1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.simpligility.maven.plugins.android.standalonemojos;
19
20 import com.simpligility.maven.plugins.android.AbstractAndroidMojo;
21 import com.simpligility.maven.plugins.android.config.ConfigHandler;
22 import com.simpligility.maven.plugins.android.config.ConfigPojo;
23 import com.simpligility.maven.plugins.android.config.PullParameter;
24 import com.simpligility.maven.plugins.android.configuration.DeployApk;
25 import com.simpligility.maven.plugins.android.configuration.ValidationResponse;
26
27 import org.apache.maven.plugin.MojoExecutionException;
28 import org.apache.maven.plugin.MojoFailureException;
29 import org.apache.maven.plugins.annotations.Mojo;
30 import org.apache.maven.plugins.annotations.Parameter;
31
32 import java.io.File;
33
34
35
36
37
38
39
40
41
42
43 @Mojo( name = "redeploy-apk", requiresProject = false )
44 public class RedeployApkMojo extends AbstractAndroidMojo
45 {
46
47
48
49
50
51
52
53
54
55 @Parameter
56 @ConfigPojo
57 protected DeployApk deployapk;
58
59 @Parameter( property = "android.deployapk.filename" )
60 private File deployapkFilename;
61
62 @PullParameter
63 private File parsedFilename;
64
65 public void execute() throws MojoExecutionException, MojoFailureException
66 {
67 ConfigHandler configHandler = new ConfigHandler( this, this.session, this.execution );
68 configHandler.parseConfiguration();
69
70 ValidationResponse response = DeployApk.validFileParameter( parsedFilename );
71 if ( response.isValid() )
72 {
73 getLog().debug( "Undeploying with file " + parsedFilename );
74 undeployApk( parsedFilename );
75 getLog().debug( "Deploying with apkFile " + parsedFilename );
76 deployApk( parsedFilename );
77 }
78 else
79 {
80 throw new MojoFailureException( response.getMessage() );
81 }
82 }
83 }