Android Drawable Maven Plugin

A Maven plugin for generating Android drawable resources from SVG files. PNG files will be generated from the SVG file at the pixel densities specified. The plugin also allows the flattening of directory structures as well as the packaging of bitmap resources alongside the SVGs

Лицензия

Лицензия

Категории

Категории

Maven Компиляция и сборка
Группа

Группа

com.github.kingamajick.admp
Идентификатор

Идентификатор

android-drawables-maven-plugin
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

maven-plugin
Описание

Описание

Android Drawable Maven Plugin
A Maven plugin for generating Android drawable resources from SVG files. PNG files will be generated from the SVG file at the pixel densities specified. The plugin also allows the flattening of directory structures as well as the packaging of bitmap resources alongside the SVGs
Ссылка на сайт

Ссылка на сайт

https://github.com/kingamajick/android-drawables-maven-plugin
Система контроля версий

Система контроля версий

http://github.com/kingamajick/android-drawables-maven-plugin/tree/master

Скачать android-drawables-maven-plugin

Как подключить последнюю версию

<plugin>
    <groupId>com.github.kingamajick.admp</groupId>
    <artifactId>android-drawables-maven-plugin</artifactId>
    <version>1.0.0</version>
</plugin>

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.apache.maven : maven-plugin-api jar 3.0.3
org.apache.maven : maven-core jar 3.0.3
org.apache.xmlgraphics : batik-transcoder jar 1.7
org.apache.xmlgraphics : batik-codec jar 1.7

test (7)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.10
org.apache.maven : maven-plugin-descriptor jar 2.2.1
org.easymock : easymockclassextension jar 3.1
org.powermock : powermock-module-junit4 jar 1.4.11
org.powermock : powermock-api-easymock jar 1.4.11
org.easytesting : fest-reflect jar 1.2
commons-codec : commons-codec jar 1.6

Модули Проекта

Данный проект не имеет модулей.

Android-Drawables-Maven-Plugin

The android-drawables-maven-plugin was created to allow the generation of Android drawable artifacts from a SVG source. After originally using the Batik Maven Plugin to perform this task, I found the amount of configuration grew rapidly so I created the android-drawables-maven-plugin to make the process simpler.

Getting Started

Prerequisities

Maven 3.0.3+ installed, see http://maven.apache.org/download.html

Creating a android-drawables artifact

  1. Create a new maven project with a packaging type of android-drawables and add the android-drawables-maven-plugin to its build configuration.

     ....    
     <packaging>android-drawables</packaging>  
     ....
     <build>
         <plugins>
             <plugin>
                 <groupId>com.github.kingamajick.admp</groupId>
                 <artifactId>android-drawables-maven-plugin</artifactId>
                 <version>1.0.0</version>
                 <extensions>true</extensions>
                 <configuration>
                     <rasterizedType>[png|jpg]</rasterizedType>
                 </configuration>
             </plugin>
           ....
         </plugins>
     </build>
    
  2. Create the following directory structure to store the drawable resources

     src/main/svg/          <= Contains any SVG resources to be rasterized
     src/main/resources/    <= Contains any static resources
         |-- ldpi
         |-- mdpi
         |-- hdpi
         |-- xhdpi
         |-- nodpi
         `-- tvdpi
    

The directories may contain sub folders (both for SVG resources and static resources). If this is the case, the resultant name of the file packaged in the will be generated from the directory structure. Given dir1\dir2\image.svg, the resulting image file name will be dir1_dir2_image.png (assuming png is the rasterizedType).

  1. By default the SVG resources are rasterized at the following dimensions.

    Output Scale Factor (relative to the SVG image dimensions)
    drawable-ldpi 0.75
    drawable-mdpi 1.00
    drawable-hdpi 1.50
    drawable-xhdpi 2.00
    If this is not suitable, custom densities can be supplied via the plugin configuration using the following form:

     <configuration>  
     ....  
         <densities>  
             <density>  
                 <name>[drawable-ldpi|drawable-mdpi|drawable-hdpi|drawable-xhdpi|drawable-nodpi|drawable-tvdpi]</name>  
              <scaleFactor></scaleFactor>  
             <density>  
         </densities>  
     ....  
     </configuration>
    

Note: By doing this all densities will have to be specified as the defaults will no longer be generated.
Note: The name must be the expected folder name for that resource, i.e drawable-type. 4. Your project is now ready to be built.

Consuming a android-drawables artifact

  1. In the project to consume a android-drawables artifact, configure the POM as follows:

     <plugin>
         <groupId>com.github.kingamajick.admp</groupId>
         <artifactId>android-drawables-maven-plugin</artifactId>
         <version>1.0.0</version>
         <extensions>true</extensions>
         <executions>
             <execution>
                 <id>Unpack Drawables</id>
                 <phase>initialize</phase>
                 <goals>
                     <goal>unpack</goal>
                 </goals>
                 <configuration>
                     <drawableArtifacts>
                         <drawableArtifact>
                             <groupId>${drawableArtifactGroupId}</groupId>
                             <artifactId>${drawableArtifactArtifactId}</artifactId>
                             <version>${drawableArtifactVersion}</version>
                         </drawableArtifact>
                     </drawableArtifacts>
                     <unpackLocation></unpackLocation>
                 </configuration>
             </execution>
         </executions>
     </plugin>
    

This will unpack the specified artifact(s) during the initialize phase.

Note: All folders will be unpacked into ${unpackLocation}/res rather than ${unpackLocation}

m2e Connector

A m2e connector is available for this plugin at https://github.com/kingamajick/android-drawables-maven-plugin-m2e

Maven Site

The maven site for this project can be found at http://kingamajick.github.com/android-drawables-maven-plugin/

Snapshots

Snapshots of the android-drawables-maven-plugin are available from the Sonatype OSS Repository Hosting Service. To use snapshots, add the following configuration to the pom.

<pluginRepositories>
    <pluginRepository>
        <id>oss-sonatype</id>
        <name>oss-sonatype</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

Версии библиотеки

Версия
1.0.0