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