我需要将诽谤(例如jQuery,Quaryjs,jquerymobile和某些时间...)排除在外。

但是对于其他目标,我需要所有目标。

编辑:

我已经创建了2个WRO文件,但仍然需要所有目标组。

WRO2.xml带有UTILS,app wro.xml,带utils,库,应用程序,jquerymobile

<plugins>
        <plugin>
            <groupId>ro.isdc.wro4j</groupId>
            <artifactId>wro4j-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
                <execution>
                    <id>ex1</id>
                    <goals>
                        <goal>jshint</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!--jshint options-->
                <options>jquery,devel,evil,noarg,eqnull</options>
                <failNever>false</failNever>
                <targetGroups>utils,app</targetGroups>
                <wroFile>${basedir}/src/main/webapp/WEB-INF/wro2.xml</wroFile>
            </configuration>
        </plugin>
        <plugin>
            <groupId>ro.isdc.wro4j</groupId>
            <artifactId>wro4j-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
                <execution>
                    <id>ex2</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!--compile options-->
                <targetGroups>utils,libraries,app,jQueryMobile</targetGroups>
                <minimize>true</minimize>
                <destinationFolder>${basedir}/src/main/webapp/wro/</destinationFolder>
                <cssDestinationFolder>${basedir}/target/webapp/css/</cssDestinationFolder>
                <jsDestinationFolder>${basedir}/target/webapp/js/</jsDestinationFolder>
                <contextFolder>${basedir}/src/main/webapp/</contextFolder>
                <ignoreMissingResources>false</ignoreMissingResources>
                <wroFile>${basedir}/src/main/webapp/WEB-INF/wro.xml</wroFile>
                <wroManagerFactory>ro.isdc.wro.extensions.manager.standalone.GoogleStandaloneManagerFactory</wroManagerFactory>
            </configuration>
        </plugin>
    </plugins>
有帮助吗?

解决方案

您有以下选项:

  1. 仅使用单独的组进行jshint处理
  2. 通过提供仅用于jshint目标的扭曲来创建不同的模型
  3. 创建WromanagerFactory的自定义实现,并以编程方式排除您不想处理的文件。

无论哪种情况,您都必须在pom.xml中两次声明插件,因为配置选项将有所不同。

编辑:

该解决方案与Maven执行配置有关,而不是与WRO4J-Maven-Plugin有关。

因此,您没有用不同的配置声明两次相同的插件,而是用两个执行声明一次,并且每个执行都有自己的配置。例子:

<plugin>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-maven-plugin</artifactId>
    <version>1.4.1</version>
    <executions>
      <execution>
        <id>ex1</id>
        <goals>
          <goal>run</goal>
        </goals>
        <configuration>
            <targetGroups>utils,libraries,app,jQueryMobile</targetGroups>
        </configuration>
      </execution>  
      <execution>
        <id>ex2</id>
        <goals>
          <goal>jshint</goal>
        </goals>
        <configuration>
          <options>jquery,devel,evil,noarg,eqnull</options>
          <failNever>false</failNever>
          <targetGroups>utils,app</targetGroups>
          <wroFile>${basedir}/src/main/webapp/WEB-INF/wro2.xml</wroFile>
    </configuration>            
      </execution>
    </executions>
  </plugin>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top