1

我对 maven 的 wro4j 插件有疑问。当我部署应用程序并执行插件以最小化和捆绑我的资源文件时,它会将新内容附加到 all.css 和 all.js 文件,而不是替换它们的内容。如果在此之前没有进行清理,那是相当麻烦的。我想知道,是否有可能以某种方式配置它?

我的配置如下:

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>
4

0 回答 0