Yui compressor StringIndexOutOfBoundsException on jboss

我的未来我决定 提交于 2019-11-28 20:48:54

Workaround: For JBoss AS 7.1.1.Final and YUICompressor 2.4.7

Exclude rhino from dependency:

        <dependency>
          <groupId>com.yahoo.platform.yui</groupId>
          <artifactId>yuicompressor</artifactId>
          <version>${yuicompressor.version}</version>
          <exclusions>
            <exclusion>
               <groupId>rhino</groupId>
               <artifactId>js</artifactId>
            </exclusion>
          </exclusions>
        </dependency>

Why? See https://github.com/greenlaw110/greenscript/pull/29#issuecomment-4017147

Note: if you have a rhino in classpath by some other way, so seems like you'll get this error again.

I solved this problem by repackaging yuicompressor myself to include most of the rhino source. See my reply to Howard M. Lewis Ship.

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>

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

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>

This should work.

The selected answer's (as of 9/26/2014) jar doesn't exist anymore.

So, I created a fork of yuicompressor where entire rhino package is embedded into the yuicompressor package and namespaced it under yui.

https://github.com/timothykim/yuicompressor

Just clone the repo and run ant to obtain the jar.

Hope this helps anyone else who stumbles unto this problem.

Really, you're having class loader problems in JBoss?

You're going to have to do some kind of exclusion on the competing rhino JAR file. Why is Rhino on the classpath? It may be an optional feature of JBoss you can turn off and avoid the conflict that way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!