Letractively / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

With the maven plugin setting wild card in the wro.xml file doesn't seems to work #847

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
with a js folder that contain 3 javascript file

What steps will reproduce the problem?
1.In the wro.xml create a group name all
2.Add the following entry <js>/javascript/*.js</js>    

What is the expected output? What do you see instead?

a all.js file with my javascript in

In stead i got nothing

What version of the product are you using? On what operating system?

1.7.3

Please provide any additional information below.

Original issue reported on code.google.com by bali...@sfeir.com on 18 Feb 2014 at 5:03

GoogleCodeExporter commented 9 years ago
I'm quite sure it works. So there is probably a misconfiguration. 
What processors are you using? What happens when none is being used. What is 
the project relative path of the javascript folder? How is yor maven plugin 
configured?

Ideally, you could fork the wro4j-examples project and provide the testcase 
which reproduces the issue.

Original comment by alex.obj...@gmail.com on 19 Feb 2014 at 8:02

GoogleCodeExporter commented 9 years ago
Ok i think i find the cause but not the solution. I try with a simple project 
with the following structure:
* src/main/webapp/js:
file1.js, file2.js
* src/main/webapp/js/rep1
file1.js, file2.js

I use the following configuration in the wro.xml file

<groups xmlns="http://www.isdc.ro/wro"> 
  <group name='test-wro4j'>
    <js>/js/**.js</js>                   
  </group>
</groups>

An this is my maven plugin configuration

<plugin>
        <groupId>ro.isdc.wro4j</groupId>
        <artifactId>wro4j-maven-plugin</artifactId>
    <version>1.7.2</version>
    <executions>
        <execution>
            <phase>prepare-package</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
<contextFolder>${basedir}/src/main/webapp, 
${project.build.directory}/${project.build.finalName}</contextFolder>                   
<jsDestinationFolder>${project.build.outputDirectory}/js/</jsDestinationFolder> 

<wroFile>${basedir}/src/main/resources/META-INF/wro.xml</wroFile>
<extraConfigFile>${basedir}/src/main/resources/META-INF/wro.properties</extraCon
figFile>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManag
erFactory</wroManagerFactory>
<ignoreMissingResources>false</ignoreMissingResources>
    </configuration>
</plugin>

The problem is when i set multi path in the contextFolder. I have to do it 
because some of my files will be generated by the maven build (for example 
handlebar compile template).
If i use a single context i can see all my file in the test-wro4j.js
If i use multi context i have no test-wro4j.js file

Those it means that wildcard can't be use with multicontext setting ?

Thank you

Cyril

Original comment by bali...@sfeir.com on 19 Feb 2014 at 10:41

GoogleCodeExporter commented 9 years ago
So, if there is a bug, then it can be reproduced only when multiple 
contextFolders are used. I didn't test this use-case. Will test it and will get 
back with a resolution.

Original comment by alex.obj...@gmail.com on 19 Feb 2014 at 1:38

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 19 Feb 2014 at 1:39

GoogleCodeExporter commented 9 years ago
Indeed, the wildcard are not located properly when multiple contextFolders are 
used. This might be not very easy to fix. 

Have you considered loading resources from a different location (ex: classpath 
or using webjars)?

Original comment by alex.obj...@gmail.com on 20 Feb 2014 at 10:44

GoogleCodeExporter commented 9 years ago
I don't really see what you mean. In fact my maven build generate a helper.js 
file in the ${project.build.directory}/${project.build.finalName} directory. 
And i want this file to be agregate with the others javascript files using 
wro4j. this is why i add this path in the contextFolders and i refer to this 
helper.js file in the wro.xml. Is there another way to congigure wro4j for this 
specific need ?

Original comment by bali...@sfeir.com on 20 Feb 2014 at 11:03

GoogleCodeExporter commented 9 years ago
Since your build requires resources which are generated during the build time, 
what I suggest is to build those resources separately and package in a jar. As 
result, you won't need multiple context folders, since you'll include existing 
resources using classpath locator. It is also possible to package those 
resources as webjars (http://www.webjars.org/) and include them like this:
<js>webjar:/path/to/my/handlebar-template.js</js>

Original comment by alex.obj...@gmail.com on 20 Feb 2014 at 11:10

GoogleCodeExporter commented 9 years ago
Ok i see. But i won't have a single javascript file for my application(which is 
not good for performance improvement). An the generated resouces was also for 
CSS files generated by LESS compilation. Ok, I'll keep listing my resource in 
the wro.xml file.

thank you for your answer

Original comment by bali...@sfeir.com on 20 Feb 2014 at 1:07