wro4j mavenプラグイン:jshintのファイルを除外するにはどうすればよいですか?
-
25-10-2019 - |
質問
jshintのために、私は任務(jquery、nockoutjs、jquerymobile、およびいくつかの程度など)を除外する必要があります。
しかし、他の目標のために、私はそれらすべてが必要です。
編集:
2つのWROファイルを作成しましたが、それでもすべてのターゲットグループが必要です。
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>
解決
次のオプションがあります。
- Jshint処理のみに個別のグループを使用します
- Jshintの目標のみに使用するWrofileを提供することにより、別のモデルを作成します
- 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>
所属していません StackOverflow