Maven 2 yui compressor maven:缺少必需的类:org.mozilla.javascript.ErrorReporter

Maven 2 yui compressor maven:缺少必需的类:org.mozilla.javascript.ErrorReporter,maven-2,yui-compressor,Maven 2,Yui Compressor,我无法在我的web应用程序中使用yui compressor maven插件。当我运行maven时,我得到以下错误 [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:c

我无法在我的web应用程序中使用yui compressor maven插件。当我运行maven时,我得到以下错误

[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 [信息]插件管理器执行目标'net.sf.alchim:yuicompressor maven plugin:0.7.1:compress'时出现内部错误:无法加载mojo'net.sf.alchim: yuicompressor maven插件:0.7.1:compress' 在插件“net.sf.alchim:yuicompressormaven plugin”中。缺少必需的类:org.mozilla.javascript.ErrorReporter 后来我发现RhinoJS插件包含这个类org.mozilla.javascript.ErrorReporter。所以我在dependency标签中包含了这个插件,但仍然得到了相同的错误

有没有人遇到过这样的错误

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

<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>                                                 

net.sf.alchim
yuicompressor maven插件
0.7.1  
编写
jslint
压紧
符合事实的
符合事实的
错误的
错误的
${project.basedir}/${webcontent.dir}/js/compressedAll.js
**/autocomplete.js
**/calendar.js
**/dialogs.js
**/下载.js
**/folding.js
**/jquery-1.4.2.min.js
**/jquery.bgiframe.min.js
**/jquery.loadmask.js
**/jquery.printelement-1.1.js
**/jquery.tablesorter.mod.js
**/jquery.tablesorter.pager.js
**/jquery.validate.js
**/jquery-ui-1.8.custom.min.js
**/languageDropdown.js
**/messages.js
**/print.js
**/tables.js
**/tabs.js
**/uwTooltip.js
犀牛
js
编写
1.6R5
org.apache.maven
maven插件api
2.0.7
假如
org.apache.maven
马文项目
2.0.7
假如
net.sf.retrotranslator
反向转换器运行时
1.2.9
运行时

您能试用最新版本(1.1)吗

0.7.1版本甚至看起来都不是。可能是依赖项解决问题?

请参阅主题


在web应用程序上使用yuicompressor的唯一方法是手动将其与rhino依赖项合并。否则,要运行的应用程序将需要在classloader加载序列中指定所需的JAR序列(youcompressor必须在rhino之前)。我也很难找到ErrorReporter类。我通过构建一个带有依赖项的jar解决了这个问题,然后将其用于我的web应用程序中

<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>

maven汇编插件
包裹
附属的
带有依赖项的jar


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

显示pom、插件配置、允许复制的内容等可能会有所帮助。感谢您的回复。在yui compressor的dependency部分下直接添加rhino js插件依赖项之后,我能够删除这个错误。但现在面临着奇怪的问题。yui压缩程序的压缩目标是将js文件聚合为一个文件,但实际上并没有压缩。缺少正确的链接