سؤال

I need to exclude libaries (like jquery, knockoutjs, jqueryMobile and some extentions...) for jsHint.

but for the other goals I need them all.

EDIT:

I've created 2 wro files but still it takes all targetGroups.

wro2.xml with utils,app wro.xml with utils,libraries,app,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>
هل كانت مفيدة؟

المحلول

You have the following options:

  1. Use separate groups for jshint processing only
  2. Create a different model by providing the wroFile to be used for jshint goal only
  3. Create a custom implementation of wroManagerFactory and exclude programmatically the files you don't want to be processed.

In either case, you'll have to declare the plugin twice in pom.xml, since the configuration options will differ.

EDIT:

The solution is related to maven execution configuration rather than to wro4j-maven-plugin.

So, instead of declaring the same plugin twice with different configurations, you declare it once with two executions and each execution has its own configuration. Example:

<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