WroModel as XML

Xml was the first DSL used to build WroModel and it is used by default by WroManager.

The xml specifies the groups of files that you wish to aggregate and minimize. Its format is fairly simple, consisting of a list of groups. Each group in turn contains a list of CSS and !JavaScript files that belong to that group.

Here is an example wro.xml file:

<?xml version="1.0" encoding="UTF-8"?>

<groups xmlns="http://www.isdc.ro/wro">
  <group name='core'>


Resource attribute

Each resource tag can have the following attributes:

Attribute Name Description
  <group name="g1">
    <css minimize="true">/path/to/style.css</css>
    <js minimize="false">/path/to/script.js</js>

This attribute will inform wro4j to not apply minification on resources which have minimize flag set to false. By default this attribute is true.

The example above uses resource paths that are relative to the servlet context. There are three other ways that you can specify the path to a CSS or JavaScript resource; from the class path, with a file URL, or with an external URL.

Relative to servlet context


Notice that the resource url starts with the / character.

From classpath:


From a file URL:


From an external URL:


Wildcard characters

Resource specifications can include wildcards. The '{{{}}}' wildcard will match any part of a single path element, while the '{{{*}}}' wildcard will match a series of directories and file names. The '?' wildcard will match a single character. Wild card characters do not work in external URLs, but they do work in file URLs. [WildcardSupport More info on wildcard support.]


A group is responsible for "grouping" resources into logical units. Each group is identified by a name. A group can have the following attributes:

| Attribute Name | Description | | name | (Required) Unique (across the model) identifier of a group | | abstract | (Optional) False by default. Available since 1.4.9. Similar to abstract bean in spring framework. An abstract group won't be visible as a group in the model. It exist solely for being referred by other groups |

Group References

A group can contain a reference to one or more other groups. This works as an 'include', so that the referring group will also be aggregated with the contents of the referenced group.

The group reference is defined with group-ref tag:

  <group name="g1">

This is useful when you want group named g1 to have the same resource used by group named g2. Here is an example:

<?xml version="1.0" encoding="UTF-8"?>

<groups xmlns="http://www.isdc.ro/wro">

  <group name='admin-site'>


  <group name='global'>

When using build-time solution, this will build the files admin-site.css and admin-site.js. admin-site.js will contain the files admin.css, global-whitespace-reset.css, and tools.css. admin-site.js will include the files admin.js & core.js.

Import directive

The wro model can be created by aggregation of several xml files. This can be done with import tag:


As a result, the groups defined in another.xml and in wro.xml are combined.

Currently import directive works only with classpath resources and absolute path locations (such as http://www.site.com/another.xml or file:/var/path/to/another.xml). Import of relative xml is not supported yet.