com.jayway.maven.plugins.android.standalonemojos.DevicesMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-maven-plugin Show documentation
Show all versions of android-maven-plugin Show documentation
Maven Plugin for Android Development
package com.jayway.maven.plugins.android.standalonemojos;
import com.android.ddmlib.IDevice;
import com.jayway.maven.plugins.android.AbstractAndroidMojo;
import com.jayway.maven.plugins.android.DeviceCallback;
import com.jayway.maven.plugins.android.common.DeviceHelper;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
* DevicesMojo lists all attached devices and emulators found with the android debug bridge. It uses the same
* naming convention for the emulator as used in other places in the Android Maven Plugin and adds the status
* of the device in the list.
*
* TODO The goal is very simple and could be enhanced for better display, a verbose option to display and to take the
* android.device paramter into account.
*
* @author Manfred Moser
* @goal devices
* @requiresProject false
*/
public class DevicesMojo extends AbstractAndroidMojo
{
/**
* Display a list of attached devices.
*
* @throws MojoExecutionException
* @throws MojoFailureException
*/
public void execute() throws MojoExecutionException, MojoFailureException
{
doWithDevices( new DeviceCallback()
{
public void doWithDevice( final IDevice device ) throws MojoExecutionException
{
getLog().info( DeviceHelper.getDescriptiveNameWithStatus( device ) );
}
} );
}
}