Skip to content

deviceinsight/azure-blob-upload-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

General

Use this Maven plugin to recursivly upload the contents of a directory to an Azure blob storage container. This is for example useful if you use the "Static website" feature for serving web resources.

Usage

This plugin is available on Maven Central.

Using it interactively:

mvn com.deviceinsight.azure:azure-blob-upload-maven-plugin:2.1.0:upload \
    -DconnectionString='DefaultEndpointsProtocol=https;AccountName=test;AccountKey=xxx;EndpointSuffix=core.windows.net' \
    -DcontainerName=testcontainer \
    -DrootDir=/tmp/contents

rootDir is the local directory you want to upload. connectionString is the Azure connection string. containerName is the container in the storage acount that you want to upload into.

Using it in your pom.xml:

<dependency>
    <groupId>com.deviceinsight</groupId>
    <artifactId>azure-blob-upload-maven-plugin</artifactId>
    <version>2.1.0</version>
</dependency>
<build>
  <plugins>
    ...
    <plugin>
      <groupId>com.deviceinsight.azure</groupId>
      <artifactId>azure-blob-upload-maven-plugin</artifactId>
      <version>2.1.0</version>
      <executions>
        <execution>
          <id>upload</id>
          <phase>deploy</phase>
          <goals>
            <goal>upload</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <connectionString>DefaultEndpointsProtocol=https;AccountName=someaccountname;AccountKey=somekey;EndpointSuffix=core.windows.net</connectionString>
        <rootDir>somedir</rootDir>
        <containerName>somecontainer</containerName>
      </configuration>
    </plugin>
  </plugins>
</build>

Excluding files from upload:

<configuration>
  <excludes>
    <exclude>extensions/**/*</exclude>
    <exclude>**/*.json</exclude>
  </excludes>
</configuration>

Only including certain files also works:

<configuration>
  <includes>
    <include>**/*.html</include>
  </includes>
</configuration>

Releasing

The plugin can be released using:

mvn deploy -Prelease