Main Page

From maven-html5manifest-plugin (inactive) Wiki
Jump to: navigation, search

The Html5Manifest Project provides a maven plugin for creating a html5 complying manifest file based on project resources and plugin configuration settings.

Maven Goals

The following maven goals are available:

generate-manifest
Generates the manifest file.

Configuration Parameter

These are parameters that can be used directly under the <configuration> tag to modify the behaviour of the plug-in:

Element Name Meaning Default value Example
outputManifestPath Output path of the manifest file that should be generated. ${basedir}/src/main/webapp/offline.appcache ${project.build.directory}/${project.build.finalName}
realResources List of FileSets that defines with resources should be include / exclude for caching
<realResources>
    <fileSet>
        <directory>src/main/webapp</directory>
        <includes>
            <include>**/*.js</include>
            <include>**/*.css</include>
            <include>**/*.js</include>
            <include>**/*.gif</include>
            <include>**/*.png</include>
            <include>**/*.jpg</include>
        </includes>
    </fileSet>
</realResources>
<realResources>
    <fileSet>
        <directory>src/main/webapp</directory>
        <includes>
            <include>**/*.js</include>
        </includes>
        <excludes>
            <exclude>**/*.gif</exclude>
        </excludes>
    </fileSet>
</realResources>
abstractResources List of strings for all abstract entries like dynamic html files that will be generated at runtime and should be cached by the client.

-

<abstractResources>
    <string>index.html</string>
    <string>error.html</string>
</abstractResources>
networkResources List of strings defining network resources that shouldn't be cached.

-

<networkResources>
    <string>*</string>
</networkResources>
fallback Fallback expression

-

<fallback>/ /offline.html</fallback>

Maven Plugin Entry

The following example executes the generate-manifest goal at the generate-sources phase with a non default configuration:

<plugin>
    <groupId>org.evolvis.maven.plugin</groupId>
    <artifactId>maven-html5manifest-plugin</artifactId>
    <version>1.0.1</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals><goal>generate-manifest</goal></goals>
        </execution>
    </executions>
    <configuration>
        <outputManifestPath>src/main/webapp/myOffline.appcache</outputManifestPath>
        <realResources>
            <fileSet>
                <directory>src/main/webapp</directory>
                <includes>
                    <include>**/*.js</include>
                </includes>
                <excludes>
                    <exclude>**/*.gif</exclude>
                </excludes>
            </fileSet>
        </realResources>
        <abstractResources>
            <string>/index.html</string>
            <string>/test.html</string>
        </abstractResources>
        <networkResources>
            <string>*</string>
        </networkResources>
        <fallback>/ /offline.html</fallback>
    </configuration>
</plugin>

A possibly generated HTML5 manifest:

CACHE MANIFEST:
 
# version: 0.1.5-SNAPSHOT
 
# real resources entries
common/lib/backbone-0.9.2.js
common/lib/backbone-0.9.2.min.js
common/lib/jquery-1.7.2.js
common/lib/jquery-1.7.2.min.js
common/lib/jquery.mobile-1.1.0.js
common/lib/jquery.mobile-1.1.0.min.js
common/lib/underscore-1.3.3.js
 
# abstract resources entries
/index.html
/test.html
 
NETWORK:
*
 
FALLBACK:
/ /offline.html

Links