Skip to content

Building

Mark Reeves edited this page Feb 20, 2018 · 9 revisions

Building is done using Maven and a normal Maven invocation. This document is not designed to teach you Maven (that is better done by Apache) but provides some hints and tips for specific build scenarios which may occur whilst working on WComponents rather than with WComponents.

Building Java without running Selenium tests

The Selenium test suite in wcomponents-examples takes more time than the rest of the build combined. If you want to run the build without the Selenium test suite, you can ignore the optional tests with a Maven flag: -DskipOptionalTests=true

Building Java without building the theme

Building wcomponent-parent will build all modules. This may be unnecessary for some use cases. The theme build is rather long as it uses Maven to launch ANT and then launches various sub-processes from ANT. For a framework Java developer it can be frustrating building the theme when no changes have been made.

To build without the theme in Maven one can skip modules using the -pl (PapaLima) flag and the ! (not) operator for the module(s) to be omitted.

From the wcomponents-parent root dir building without the theme one would use:

mvn -pl '!wcomponents-theme-parent,!wcomponents-theme' compile

Note that we exclude wcomponents-theme explicitly as it is included as a module in wcomponents-examples and wcomponents-bundle so would be built if we only excluded wcomponents-theme-parent.

Building the theme

Maven for beginners: theme developers may not have Maven experience as it is a Java tool. So a few simple commands are listed below. A good, Maven aware IDE (such as NetBeans) will provide point-and-click builds. The following are command-line suggestions. For information about using Maven see the Maven guides.

building for beginners

Theme devs have it easy (well, easy for Maven) - just compile the wcomponents-theme or wcomponents-theme-parent project. From the command line in the wcomponents-theme directory one would use:

mvn compile

Note, though, it is common to clean before a build. Clean removes the last build completely:

mvn clean compile

When doing dev builds one may want to skip tests:

mvn -DskipTests clean compile

To use a build in a project (such as within the examples LDE) it is installed into your local repo (a clean is recommended in this case):

mvn clean install

Building the theme from the parent

To build the theme from the wcomponents-parent dir, without building the other modules, ones uses the -pl (PapaLima) flag. To build only the theme from the parent directory, for example, one could use the following:

mvn -pl wcomponents-theme compile

Theme build options

There are a few options which are able to be set when building the theme. These build options and how to implement them are detailed in wcomponents-theme/user.xml. All of these options have default settings which will build the theme as per the deployed version of WComponents.

The following XML shows some of the properties @marksreeves commonly uses when debugging build issues. These are probably the only two build properties worth using. See Theme testing for information regarding properties used to configure JavaScript unit tests.

<!-- 
  Using a timestamp in a directory name is useful 
  for comparing runs of a build change or tests.
-->
<tstamp>
  <format
    property="time.stamp"
    pattern="yyyyMMdd-HHmmss"/>
</tstamp>

<!--
  KEEP BUILD FILES IN A KNOWN LOCATION
  Sometimes it is useful to keep the build temporary artefacts
  if the build is not working as expected.
-->
<property 
  name="tmp.dir" 
  location="/PATH/TO/SOME/KNOWN/FOLDER/${time.stamp}"/>
<property 
  name="build.preserve.tmp.onexit" 
  value="true"/>
Clone this wiki locally