yui压缩器专家:缺少必需的类:org.mozilla.javascript.ErrorReporter [英] yui compressor maven: A required class is missing: org.mozilla.javascript.ErrorReporter

查看:114
本文介绍了yui压缩器专家:缺少必需的类:org.mozilla.javascript.ErrorReporter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在我的Web应用程序中使用yui-compressor maven插件.当我运行Maven时,出现以下错误

I am not able to use yui-compressor maven plugin in my web app. When I run maven I get following error


[INFO] Internal error in the plugin manager executing goal 'net.sf.alchim:yuicompressor-maven-plugin:0.7.1:compress': Unable to load the mojo 'net.sf.alchim:
yuicompressor-maven-plugin:0.7.1:compress' 
in the plugin 'net.sf.alchim:yuicompressor-maven-plugin'. A required class is missing: org.mozilla.javascript.ErrorReporter

后来,我发现rhino js插件包含此类org.mozilla.javascript.ErrorReporter.因此,我将此插件包含在依赖项标签中,但仍然遇到相同的错误.

Later I found that rhino js plugin contains this class org.mozilla.javascript.ErrorReporter. So I included this plugin in dependency tag but still I am getting the same error.

有人遇到过这样的错误.

Has anyone came across such error.

->更新主要问题以添加pom插件详细信息

--> updating main question to add the pom plugin details

<plugin>
    <groupId>net.sf.alchim</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>0.7.1</version>  
    <executions>
      <execution>
     <phase>compile</phase>
        <goals>
         <goal>jslint</goal>
          <goal>compress</goal>
        </goals>
      </execution>
    </executions>        
    <configuration>
    <failOnWarning>true</failOnWarning>
      <nosuffix>true</nosuffix>
      <aggregations>
       <aggregation>
          <!-- remove files after aggregation (default: false) -->
          <removeIncluded>false</removeIncluded>
          <!-- insert new line after each concatenation (default: false) -->
          <insertNewLine>false</insertNewLine>
          <output>${project.basedir}/${webcontent.dir}/js/compressedAll.js</output>
          <!-- files to include, path relative to output's directory or absolute path-->
          <!--inputDir>base directory for non absolute includes, default to parent dir of output</inputDir-->
          <includes>                
            <include>**/autocomplete.js</include>
            <include>**/calendar.js</include>
            <include>**/dialogs.js</include>
            <include>**/download.js</include>
            <include>**/folding.js</include>
            <include>**/jquery-1.4.2.min.js</include>
            <include>**/jquery.bgiframe.min.js</include>
            <include>**/jquery.loadmask.js</include>
            <include>**/jquery.printelement-1.1.js</include>
            <include>**/jquery.tablesorter.mod.js</include>
            <include>**/jquery.tablesorter.pager.js</include>
            <include>**/jquery.validate.js</include>  
            <include>**/jquery-ui-1.8.custom.min.js</include>
            <include>**/languageDropdown.js</include>
            <include>**/messages.js</include>
            <include>**/print.js</include>
            <include>**/tables.js</include>
            <include>**/tabs.js</include>
            <include>**/uwTooltip.js</include>
          </includes>
          <!-- files to exclude, path relative to output's directory-->

        </aggregation>
      </aggregations>
    </configuration>
    <dependencies>
         <dependency> 
 <groupId>rhino</groupId>  
  <artifactId>js</artifactId>       
  <scope>compile</scope>  
  <version>1.6R5</version> 
</dependency>  
<dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>2.0.7</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-project</artifactId>
        <version>2.0.7</version>
        <scope>provided</scope>
    </dependency><dependency>
        <groupId>net.sf.retrotranslator</groupId>
        <artifactId>retrotranslator-runtime</artifactId>
        <version>1.2.9</version>
        <scope>runtime</scope>
    </dependency>

    </dependencies>
  </plugin>                                                 

推荐答案

我也为ErrorReporter类丢失而苦苦挣扎.我通过构建一个具有依赖关系的jar来解决了这个问题,然后将其转用于我的Web应用程序中,

I struggled with the ErrorReporter class missing too. I solved it by building a jar-with-dependencies which I then turned around to use in my web app,

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
  <execution>
    <phase>package</phase>
    <goals>
      <goal>attached</goal>
    </goals>
  </execution>
</executions>
<configuration>
  <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
  </descriptorRefs>
</configuration>

一旦我这样做,一切都会正常.在我的jar中,我可以看到org.mozilla.javascript.ErrorReporter.class在那里,然后Maven会为我编译.

Once I did that, everything worked. In my jar I could see that the org.mozilla.javascript.ErrorReporter.class was in there and Maven would then compile for me.

这篇关于yui压缩器专家:缺少必需的类:org.mozilla.javascript.ErrorReporter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆