Wro4j - 犀牛实现

Wro4j - Rhino implementation

我正在尝试在我的 Maven 项目中实施 Wro4j。

我在 pom.xml 中添加了以下代码依赖项:

<properties>
    <wro4j.version>1.7.9</wro4j.version>
</properties>
<dependency>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-core</artifactId>
    <version>${wro4j.version}</version>
</dependency>
<dependency>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-extensions</artifactId>
    <version>${wro4j.version}</version>
</dependency>
<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>envjs</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>org.mozilla</groupId>
    <artifactId>rhino</artifactId>
    <version>1.7R4</version>
</dependency>

这是出现的错误:

7:26:58,396 ERROR [LessCss] Processing error:Couldn't initialize env.rhino script
java.lang.RuntimeException: Couldn't initialize env.rhino script
    at ro.isdc.wro.extensions.script.RhinoScriptBuilder.addClientSideEnvironment(RhinoScriptBuilder.java:96)
    at ro.isdc.wro.extensions.script.RhinoScriptBuilder.newClientSideAwareChain(RhinoScriptBuilder.java:233)
    at ro.isdc.wro.extensions.processor.support.less.LessCss.initScriptBuilder(LessCss.java:45)
    at ro.isdc.wro.extensions.processor.support.less.LessCss.less(LessCss.java:84)
    at ro.isdc.wro.extensions.processor.css.RhinoLessCssProcessor.process(RhinoLessCssProcessor.java:130)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.LazyProcessorDecorator.process(LazyProcessorDecorator.java:49)
    at ro.isdc.wro.extensions.processor.js.AbstractNodeWithFallbackProcessor.process(AbstractNodeWithFallbackProcessor.java:59)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.SupportAwareProcessorDecorator.process(SupportAwareProcessorDecorator.java:39)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.ExceptionHandlingProcessorDecorator.process(ExceptionHandlingProcessorDecorator.java:56)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.BenchmarkProcessorDecorator.process(BenchmarkProcessorDecorator.java:44)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.DefaultProcessorDecorator.process(DefaultProcessorDecorator.java:42)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.process(PreProcessorExecutor.java:228)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.applyPreProcessors(PreProcessorExecutor.java:207)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.processAndMerge(PreProcessorExecutor.java:103)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.processAndMerge(PreProcessorExecutor.java:77)
    at ro.isdc.wro.model.group.processor.GroupsProcessor.process(GroupsProcessor.java:83)
    at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:101)
    at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:35)
    at ro.isdc.wro.cache.support.AbstractSynchronizedCacheStrategyDecorator.get(AbstractSynchronizedCacheStrategyDecorator.java:55)
    at ro.isdc.wro.manager.ResourceBundleProcessor.serveProcessedBundle(ResourceBundleProcessor.java:63)
    at ro.isdc.wro.manager.WroManager.process(WroManager.java:159)
    at ro.isdc.wro.http.WroFilter.processRequest(WroFilter.java:340)
    at ro.isdc.wro.http.WroFilter.doFilter(WroFilter.java:295)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: No webjar with uri: env.rhino.js available.
    at ro.isdc.wro.extensions.locator.WebjarUriLocator.locate(WebjarUriLocator.java:72)
    at ro.isdc.wro.extensions.script.RhinoScriptBuilder.addClientSideEnvironment(RhinoScriptBuilder.java:92)
    ... 42 more
Caused by: java.lang.IllegalArgumentException: env.rhino.js could not be found. Make sure you've added the corresponding WebJar and please check for typos.
    at org.webjars.WebJarAssetLocator.throwNotFoundException(WebJarAssetLocator.java:174)
    at org.webjars.WebJarAssetLocator.getFullPath(WebJarAssetLocator.java:213)
    at org.webjars.WebJarAssetLocator.getFullPath(WebJarAssetLocator.java:189)
    at ro.isdc.wro.extensions.locator.WebjarUriLocator.locate(WebjarUriLocator.java:69)
    ... 43 more

我是不是做错了什么?只要文件已经存在于org.webjars依赖中,如何解决系统丢失env.rhino.js的问题?欢迎任何不使用 maven 插件的解决方案。

似乎 wro4j-extensions 对 1.7.9 版本的依赖没有 env.rhino.js。我将 wro4j.version 降级到 1.7.0,并且运行良好。我假设 wro4j-extensions 被错误地删除了 env.rhino.js,或者他们把它移到了另一个地方。