1

I have problem with wro4j plugin for maven. When I'm deploying application and plugin is executed to minimize and bundle my resource files it append new content to all.css and all.js files instead of replacing theirs content. It is quite troublesome if there is no cleanup done before it. I wonder, if it is possible to configure it somehow?

My config below:

web.xml

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

    <error-page>
        <exception-type>org.springframework.security.web.authentication.rememberme.CookieTheftException</exception-type>
        <location>/login</location>
    </error-page>

    <filter>
        <filter-name>CorsFilter</filter-name>
        <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
        <init-param>
            <param-name>cors.allowed.origins</param-name>
            <param-value>*</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>CorsFilter</filter-name>
        <url-pattern>/resources/*</url-pattern>
   </filter-mapping>

</web-app>

wro.xml

<groups xmlns="http://www.isdc.ro/wro"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.isdc.ro/wro">
    <group name="all">
        <js>/resources/js/jquery*.js</js>
        <js>/resources/js/bootstrap.min.js</js>
        <js>/resources/js/bootstrap-*.js</js>
        <js>/resources/js/**.js</js>
        <css>/resources/css/bootstrap.min.css</css>
        <css>/resources/css/sunbasket-web.css</css>
        <css>/resources/css/bootstrap-*.css</css>
        <css>/resources/css/**.css</css>
   </group>
</groups>

pom.xml

<plugin>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-maven-plugin</artifactId>
    <version>1.8.0</version>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <targetGroups>all</targetGroups>
        <cssDestinationFolder>${project.basedir}/src/main/webapp/resources/css/</cssDestinationFolder>
        <jsDestinationFolder>${project.basedir}/src/main/webapp/resources/js/</jsDestinationFolder>          
        <contextFolder>${project.basedir}/src/main/webapp/</contextFolder>
        <wroFile>${project.basedir}/src/main/webapp/WEB-INF/wro.xml</wroFile>
        <extraConfigFile>${project.basedir}/src/main/resources/wro.properties</extraConfigFile>
        <ignoreMissingResources>false</ignoreMissingResources>
    </configuration>
</plugin>
Glapa
  • 790
  • 10
  • 20
  • It is suppose to replace the content. If it doesn't, please raise an issue here: https://github.com/wro4j/wro4j/issues As a workaround, use mvn clean before running wro4j maven plugin – Alex Objelean Apr 27 '16 at 08:49

0 Answers0