Disabling Version Generation

The technique described in this section is not intended for use in ordinary publication projects. You should only use it in shared webapp projects.

The standard build process defined in com.escenic.widget-framework:wf-project-core involves a Shade plug-in execution called generate-version. What generate-version does is to rename the static files in the project (e.g, Javascript and CSS files), giving them names that depend upon their content. It generates a checksum from the content of each file, and then appends the resulting checksum to the filename. This means that the output static files have names that change every time the content of the file has changed.

Doing this means that content delivery networks and caches can be instructed to cache the static files for a very long time (for maximum efficiency), with no risk of serving old versions of the files. Any change to one of the static files will result in its name changing, so an old version will never be requested or served even if it is still in the cache.

In the standard build process, all Javascript and CSS files in a project are merged to single files, and the resulting files are renamed by generate-version.

It is sometimes the case that you want several publications to be able to share some common functionality. One way of achieving this is to create a shared webapp that provides this functionality, and then create publications based on the shared webapp. In other words, the shared webapp is configured with the Widget Framework's default com.escenic.widget-framework:wf-project-core as its parent project, and the actual publications are configured with the shared webapp as their parent project.

If you use this method of creating shared functionality, then the generate-version process should only be performed once, and it should be performed during the publication builds, not the shared webapp build. You therefore need to disable it in the shared webapp build. To disable the execution, add the following execution element to the Shade plug-in configuration in your shared webapp's POM file:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>2.2</version>
  <dependencies>
    <dependency>
      <groupId>com.escenic.widget-framework</groupId>
      <artifactId>wf-build-tools</artifactId>
      <version>${wf.version}</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <id>generate-version</id>
      <phase/>
    </execution>
    ...
  </executions>
</plugin>

The empty phase element in this addition effectively disables the execution of generate-version.