我需要为jsHint排除libaries(如jquery,knockoutjs,jqueryMobile和一些扩展......)。
但是对于其他目标我都需要它们。
修改
我创建了2个wro文件,但它仍然需要所有targetGroups。
带有utils的应用程序的wro2.xml 带有utils,libraries,app,jQueryMobile的wro.xml
<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>
答案 0 :(得分:2)
您有以下选择:
在任何一种情况下,您都必须在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>