Overview

The CRX Maven Plugin is responsible for collecting all the resources of a Google Chrome Extension and packaging them into a signed CRX archive.

Goals Overview

  • crx:crx is the default goal invoked during the packaging phase for projects with a packaging type of crx. It builds the signed CRX archive.
  • crx:crx-verify is invoked during the verification phase for projects with a packaging type of crx. IT verifies the integrity of the CRX archive.

Usage

General instructions on how to use the Maven CRX Plugin can be found on the usage page. Some more specific use cases are described in the examples given below.

Examples

To provide you with better understanding on some usages of the Maven CRX Plugin, you can take a look into the following examples:

Lifecycle

The lifecycle for a Google Chrome Extension is as follows:

  • package - the sources in ./src/main/chrome are assembled in memory into a ZIP file format that is then signed and output in the Google Chrome Extension format with the extension .crx. This is the CRX archive.
  • verify - the signature of the CRX archive is checked.
  • install - the CRX archive is deployed to the user's local repository.
  • deploy - the CRX archive file is deployed to the remote release or snapshot repository.

Security

It is recommended that your private key not be included in your project sources and furthermore that it be password protected.

You can specify the location of your private key and the password on you Maven command line setting the crxPEMFile and crxPEMPassword properties as follows:

$ mvn -DcrxPEMFile=~/crx.pem -DcrxPEMPassword=SparkleAndFade install

Or you can add them to your ~/.m2/settings.xml file as follows:

<settings>
  ...
  <profiles>
    ...
    <profile>
      <id>crx</id>
      <properties>
        <crxPEMFile>${user.home}/crx.pem</crxPEMFile>
        <crxPEMPassword>SparkleAndFade</crxPEMPassword>
      </properties>
    </profile>
    ...
  </profiles>
  ...
</settings>

Also it is possible to password protect your the password.

Example