Search code examples
javamavenwro4j

Wro4j maven plugin: Invalid wro.xml


I'm trying to get the wro4j maven plugin working, unfortunatly I'm being presented with an error that I do not quite understand it's reason:

[ERROR] Failed to execute goal ro.isdc.wro4j:wro4j-maven-plugin:1.5.0:run (proprocess-   resources) on project someapp-webapp: Exception occured while processing: startup failed:
[ERROR] Script1.groovy: 1: unexpected token: < @ line 1, column 1.
[ERROR] <groups xmlns="http://www.isdc.ro/wro"

Here's my configuration:

pom.xml:

<plugin>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-maven-plugin</artifactId>

    <executions>
        <execution>
            <id>proprocess-resources</id>
            <phase>compile</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>

    <configuration>
        <targetGroups>all</targetGroups>
        <wroFile>src/build/wro.xml</wroFile>
        <destinationFolder>${project.build.directory}/dist</destinationFolder>
        <contextFolder>${basedir}/src/main/webapp/</contextFolder>
        <extraConfigFile>src/build/wro.properties</extraConfigFile>
    </configuration>

</plugin>

And here's my wro.xml file:

<groups xmlns="http://www.isdc.ro/wro"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.isdc.ro/wro wro.xsd">

  <group name="all">
    <js>/src/main/webapp/js</js>
    <css>/src/main/webapp/css</css>
  </group>

</groups>

Also I have a wro.properties file:

debug=true
gzipResources=false
ignoreMissingResources=true
jmxEnabled=true
managerFactoryClassName=ro.isdc.wro.examples.manager.CustomWroManager
preProcessors=sassCss

I don't see something that I could have missed in the wro4j documentation, for any suggestions I will be grateful!


Solution

  • By default, wro4j uses SmartWroModelFactory which tries sequentially to build the model using all available DSLs: xml, groovy, json. Your failure indicates that the xml model could not be created, therefore it tried to create it as a groovy DSL. Since the provided xml model seems to be valid, the only reason why you get the failure is that the xml location is not a valid one.

    Probably you could try to replace:

    <wroFile>src/build/wro.xml</wroFile> with <wroFile>/src/build/wro.xml</wroFile>