问题描述
当使用2.4.6最小化yui时,我遇到了这个问题:
When minimising yui with 2.4.6, I get this problem:
java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:232
java.lang.StringIndexOutOfBoundsException: String index out of range: 232
at java.lang.String.substring(String.java:1934)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceString(JavaScriptCompressor.java:267)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:330)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
通过我的IDE启动但部署时有效它不是jboss。这个地方:有一些讨论同样的问题。
It works when started through my IDE but when deployed to jboss it doesn't. This place: http://yuilibrary.com/forum/viewtopic.php?p=20086 has some discussion of the same problem.
显然问题是org / mozilla / javascript / Parser在我的maven配置中拉入的两个罐子里面:
Apparently the issue is around org/mozilla/javascript/Parser being in the two jars that are pulled in from my maven config:
<dependency>
<groupId>com.yahoo.platform.yui</groupId>
<artifactId>yuicompressor</artifactId>
<version>2.4.6</version>
</dependency>
我有什么方法可以使用maven排除等或升级我的YUI版本来解决这个问题。它似乎很糟糕,它只是不起作用,我不想写一个自定义的类加载器。
Is there any way I can solve this using maven exclusions etc. or by upgrading my version of YUI. It seems daft that it just doesn't work and I don't want to have to write a custom classloader.
请帮助!
推荐答案
我通过自己重新包装yuicompressor来解决这个问题,以包含大部分的rhino源代码。请参阅我对Howard M. Lewis Ship的回复。
I solved this problem by repackaging yuicompressor myself to include most of the rhino source. See my reply to Howard M. Lewis Ship.
重新包装的来源可以在这里找到:。只需将其添加到您的pom:
The repackaged source can be found here : http://viscri.co.uk/labs/tapestry/yuicompressor-rhino-bugfix-5.0.jar. Just add this to your pom:
<dependency>
<groupId>yuicompressorbugfix</groupId>
<artifactId>yuicompressor-rhino-bugfix</artifactId>
<version>5.0</version>
</dependency>
如果您没有运行自己的nexus版本,则必须在你想要建立的机器。这是您需要的命令:
If you don't run your own version of nexus, you'll have to install it on the machine that you want to build on. This is the command you need I think: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
您还需要排除yuicompressor版本挂毯拉进来:
You'll also need to exclude the yuicompressor version that tapestry pulls in:
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-yuicompressor</artifactId>
<version>5.3.2</version>
<exclusions>
<exclusion>
<groupId>com.yahoo.platform.yui</groupId>
<artifactId>yuicompressor</artifactId>
</exclusion>
</exclusions>
这应该可行。
这篇关于关于jboss的Yui压缩器StringIndexOutOfBoundsException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!