webjars and wro4j-maven-plugin

443 views
Skip to first unread message

Dave Paroulek

unread,
Mar 12, 2013, 8:53:24 AM3/12/13
to wr...@googlegroups.com
I noticed that the wro4j-maven-plugin can't seem to find webjars on the classpath? I have the plugin defined in my pom like so: 

<plugin>
        <groupId>ro.isdc.wro4j</groupId>
        <artifactId>wro4j-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <minimize>true</minimize>
          <destinationFolder>${basedir}/src/main/webapp/static/</destinationFolder>
          <contextFolder>${basedir}/src/main/webapp/</contextFolder>
          <wroFile>${basedir}/src/main/webapp/WEB-INF/wro.xml</wroFile>
          <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
          <ignoreMissingResources>false</ignoreMissingResources>
        </configuration>
       </plugin>

And then I have the jquery web jar listed as a dependency: 

    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>jquery</artifactId>
      <version>1.9.1</version>
    </dependency>

My wro.xml contains: 

<group name="jquery">
   
<js>classpath:/META-INF/resources/webjars/jquery/1.9.1/jquery.js</js>
 
</group>
 
At runtime, this works fine. But at build time, I see this: 

[INFO] processing group: jquery.js
0    ERROR PreProcessorExecutor - Cannot ignore missing resource:  ro.isdc.wro.model.resource.Resource@1f87f5d[JS,classpath:/META-INF/resources/webjars/jquery/1.9.1/jquery.js,true]
1    ERROR WroRuntimeException  - Exception while merging resources: Couldn't get InputStream from this resource: classpath:/META-INF/resources/webjars/jquery/1.9.1/jquery.js



My next step is to debug thru the wro4j-maven-plugin. I suspect maybe maven plugin's can't see the project's runtime dependencies? or something strange like that? I'll keep digging, but just wondered if anyone has seen this before?

Thanks!
Dave

Alex Objelean

unread,
Mar 12, 2013, 9:39:00 AM3/12/13
to wr...@googlegroups.com

Have you tried the following: 

classpath:META-INF/resources/webjars/jquery/1.9.1/jquery.js

Notice the missing / after "classpath:" prefix. Probably the ClasspathUriLocator can be improved to detect stream correctly also when leading / is encountered.

Cheers,
Alex

Dave Paroulek

unread,
Mar 12, 2013, 3:03:44 PM3/12/13
to wr...@googlegroups.com
Thanks Alex, removing the first "/" fixed the issue.

Dave
Reply all
Reply to author
Forward
0 new messages