1

jsHint のライブラリ (jquery、knockoutjs、jqueryMobile など) を除外する必要があります。

しかし、他の目標のためには、それらすべてが必要です。

編集:

2 つの wro ファイルを作成しましたが、それでもすべての targetGroups が必要です。

wro2.xml と utils,app wro.xml と 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>
4

1 に答える 1

2

次のオプションがあります。

  1. jshint 処理のみに個別のグループを使用する
  2. jshint ゴールのみに使用される wroFile を提供して、別のモデルを作成します
  3. wroManagerFactory のカスタム実装を作成し、処理したくないファイルをプログラムで除外します。

いずれの場合も、構成オプションが異なるため、pom.xml でプラグインを 2 回宣言する必要があります。

編集:

解決策は、wro4j-maven-plugin ではなく、maven 実行構成に関連しています。

したがって、同じプラグインを異なる構成で 2 回宣言する代わりに、2 回の実行で 1 回宣言し、各実行には独自の構成があります。例:

<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>
于 2011-11-29T15:33:01.507 に答える