java - Install Android SDK during Maven build -


i trying automate testing android app using maven , robolectric. problem have won't running tests on local machine , android sdk won't installed on machine running tests. have used maven-dependency-plugin grab sdk our repository , unpacked in process resources phase, problem occurs after need access files. when try use apk packaging never gets sdk download because can't find sdk. question this: possible trigger download before else happens in build? if has light shed on how install sdk @ build time appreciated. let me know if can add additional information.

both robolectric , maven-android-plugin both need sdk. android plug-in requires build tools/adb while robolectric needs corresponding android.jar.

so, you'll have create maven tasks/goals for:

  1. download sdk zip url.
  2. unpack zip on test machine, in directory.
  3. update android.sdk.path property of pom, point sdk directory.

some snippets found, might help:

download:

<plugin>     <groupid>org.codehaus.mojo</groupid>     <artifactid>wagon-maven-plugin</artifactid>     <version>1.0-beta-3</version>     <executions>         <execution>             <id>download-android-sdk</id>             <phase>pre-integration-test</phase>             <goals>                 <goal>download-single</goal>             </goals>             <configuration>                 <url>http://dowloadsite.com/<url>                 <fromfile>/downloads/sdk.zip</fromfile>                 <todir>${project.build.directory}/sdk</todir>             </configuration>         </execution>     </executions> </plugin> 

unpack:

<plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-antrun-plugin</artifactid>     <version>1.6</version>     <executions>         <execution>             <id>unpack-sdk</id>             <phase>pre-integration-test</phase>             <configuration>                 <tasks>                     <unzip src="${project.build.directory}/sdk/sdk.zip" dest="${project.build.directory}/sdk/" />                 </tasks>             </configuration>             <goals>                 <goal>run</goal>             </goals>         </execution>     </executions> </plugin> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -