2

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!

Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
  • I took the sample XML from the webpage. The above didn't help, but it seems Wro4j uses the GroovyModelFactory as a default. The webpage doesn't point this out... Changing to groovy helps. http://code.google.com/p/wro4j/wiki/GroovyWroModel –  Nov 13 '12 at 13:19
  • it uses groovyModelFactory only if it fails to parse xml DSL. Check out the working example from examples module. – Alex Objelean Nov 13 '12 at 13:33

2 Answers2

3

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>

Alex Objelean
  • 3,893
  • 2
  • 27
  • 36
1

I found I had to remove the XML file and create a wro.groovy file instead on wro4j 1.6.2.

groups {
  group1 {
    js("/app/**.js")
    css("/resources/css/*.css")
  }
  all {
    group1()
  }
}
occasl
  • 5,303
  • 5
  • 56
  • 81