4 Replies Latest reply on Aug 1, 2012 9:17 AM by leesy

    [m2e-wro4j] Anyone Have An Example Project?

    leesy

      HI all,

       

      I've been trying to get m2e-wro4j working this morning but I'm not having much luck.  Does anyone have an example project with it working so that I can try it in my version of Eclipse.  I'm wondering if I'm missing a prerequisite.

       

      I've looked at the blog bost found here but it's not helping much.  I believe m2e-wro4j is installed correctly as I do get the option to add a wro4j plugin when I hit CTRL + Space in my POM.  But try as I might, my files never get combined into the resources I am expecting.  I get a m2e-wtp folder in my target directory but it only contains a META-INF folder.

       

      Can anyone think of anything I might have missed?  Here's a snapshot of my POM setup.

       

      <plugin>
        <groupId>ro.isdc.wro4j</groupId>
        <artifactId>wro4j-maven-plugin</artifactId>
        <version>${version.wro4j}</version>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
          <destinationFolder>${project.build.directory}/${project.build.finalName}/includes/</destinationFolder>
          <jsDestinationFolder>${project.build.directory}/${project.build.finalName}/includes/js/</jsDestinationFolder>
          <cssDestinationFolder>${project.build.directory}/${project.build.finalName}/includes/css/</cssDestinationFolder>
        </configuration>
      </plugin>
      

       

      Wro4j.xml in my WEB-INF looks like:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <groups xmlns="http://www.isdc.ro/wro">
      
        <!-- Main application styles -->
        <group name="style">
          <css>/includes/css/appstoolbar.css</css>
          <css>/includes/less/oomixins.less</css>
          <css>/includes/less/variables.less</css>
          <css>/includes/less/base.less</css>
          <css>/includes/less/ie6.less</css>
          <css>/includes/less/ie7.less</css>
        </group>
      
        <group name="scripts">
          <js>/includes/js/common.js</js>
        </group>
      
      </groups>
      

       

      Any help will be greatly appreciated.  For now I'll stick to manually running the wro4j maven goal

        • 1. Re: [m2e-wro4j] Anyone Have An Example Project?
          dgolovin

          Looks like you don't have wro.xml file in WEB-INF picked up by plugin and you probably have exception in standard output (see below). Does Updating Maven Project configuration help? It seems to help in my case.

          ro.isdc.wro.WroRuntimeException: Cannot create model using any of provided factories
               at ro.isdc.wro.extensions.model.factory.SmartWroModelFactory.create(SmartWroModelFactory.java:187)
               at ro.isdc.wro.extensions.model.factory.SmartWroModelFactory.create(SmartWroModelFactory.java:34)
               at ro.isdc.wro.model.factory.WroModelFactoryDecorator.create(WroModelFactoryDecorator.java:30)
               at ro.isdc.wro.model.factory.ModelTransformerFactory.create(ModelTransformerFactory.java:47)
               at ro.isdc.wro.model.factory.ModelTransformerFactory.create(ModelTransformerFactory.java:25)
               at ro.isdc.wro.model.factory.WroModelFactoryDecorator.create(WroModelFactoryDecorator.java:30)
               at ro.isdc.wro.model.factory.FallbackAwareWroModelFactory.create(FallbackAwareWroModelFactory.java:48)
               at ro.isdc.wro.model.factory.FallbackAwareWroModelFactory.create(FallbackAwareWroModelFactory.java:22)
               at ro.isdc.wro.model.factory.WroModelFactoryDecorator.create(WroModelFactoryDecorator.java:30)
               at ro.isdc.wro.model.factory.InMemoryCacheableWroModelFactory.access$101(InMemoryCacheableWroModelFactory.java:19)
               at ro.isdc.wro.model.factory.InMemoryCacheableWroModelFactory$1.initialize(InMemoryCacheableWroModelFactory.java:32)
               at ro.isdc.wro.model.factory.InMemoryCacheableWroModelFactory$1.initialize(InMemoryCacheableWroModelFactory.java:29)
               at ro.isdc.wro.util.DestroyableLazyInitializer.get(DestroyableLazyInitializer.java:36)
               at ro.isdc.wro.model.factory.InMemoryCacheableWroModelFactory.create(InMemoryCacheableWroModelFactory.java:42)
               at ro.isdc.wro.model.factory.InMemoryCacheableWroModelFactory.create(InMemoryCacheableWroModelFactory.java:19)
               at ro.isdc.wro.model.factory.WroModelFactoryDecorator.create(WroModelFactoryDecorator.java:30)
               at ro.isdc.wro.manager.WroManager$3.create(WroManager.java:433)
               at ro.isdc.wro.manager.WroManager$3.create(WroManager.java:428)
               at ro.isdc.wro.maven.plugin.AbstractWro4jMojo.getTargetGroupsAsList(AbstractWro4jMojo.java:198)
               at ro.isdc.wro.maven.plugin.Wro4jMojo.doExecute(Wro4jMojo.java:113)
               at ro.isdc.wro.maven.plugin.AbstractWro4jMojo.execute(AbstractWro4jMojo.java:106)
               at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
               at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:312)
               at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:45)
               at org.jboss.tools.m2e.wro4j.internal.Wro4jBuildParticipant.build(Wro4jBuildParticipant.java:82)
               at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:180)
               at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
               at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
               at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
               at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
               at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
               at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
               at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
               at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
               at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
               at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
               at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
               at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
          
          • 2. Re: [m2e-wro4j] Anyone Have An Example Project?
            dgolovin

            Lee, I folowed the links and got this working for richfaces-web app from JBoss Central. I would try to start eclipse from command line and check if there are any error mesages or exceptions in standard error output.

            I have only two differences from your project:

            1. I have WEB-INF/wro.xml instead of WEB-INF/Wro4j.xml

            2. I configured only jsDestinationFolder and cssDestinationFolder in configuration

            • 3. Re: [m2e-wro4j] Anyone Have An Example Project?
              fbricon

              Denis is right, you need to rename your wro4j.xml to wro.xml.

               

              You can find a working sample here : https://github.com/jbosstools/m2e-wro4j/tree/master/org.jboss.tools.m2e.wro4j.tests/projects/p1

              • 4. Re: [m2e-wro4j] Anyone Have An Example Project?
                leesy

                Cheers for the replies guys & sorry for not saying thanks earlier!  I did change the wro4j descriptor to wro.xml but that's not made any difference.  I appear to have the plugin added correctly too.  I'm definitely not getting anything happening though.  I'll keep looking and see if I can find what's going wrong.  I'll post back if I do find out what it was.