2010-09-29 217 views
0

我無法在我的web應用程序中使用yui-compressor maven插件。當我運行Maven我收到以下錯誤yui壓縮機maven:缺少必需的類:org.mozilla.javascript.ErrorReporter

 
[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 

後來我發現,犀牛JS插件包含此類org.mozilla.javascript.ErrorReporter。所以我將這個插件包含在依賴關係標記中,但仍然出現相同的錯誤。

有沒有人遇到過這樣的錯誤。

- >更新主要問題補充了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>             
+0

顯示一個pom,插件配置,允許重現等等可能會有所幫助。 – 2010-09-29 15:48:08

+0

感謝您的回覆。在直接在yui壓縮器的依賴部分下添加rhino js插件依賴項後,我能夠刪除此錯誤。但現在面臨奇怪的問題。 yui壓縮器的壓縮目標是將js文件合併爲一個,但實際上不壓縮。 – hanumant 2010-09-30 04:20:24

回答

0

請參閱主題Yui compressor StringIndexOutOfBoundsException on jboss

使用的YUICompressor上的web應用程序是犀牛依賴手工合併的唯一辦法。否則,要運行的應用程序需要在類加載器加載順序中指定所需的jar序列(您的壓縮器必須在犀牛之前運行)。

+0

正確的鏈接丟失 – 2013-09-24 06:34:17

0

我掙扎着ErrorReporter類也缺少。我解決它通過建立一個罐子,有依賴性,然後我轉身在我的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> 

,一切工作一旦我做到了。在我的jar中,我可以看到org.mozilla.javascript.ErrorReporter.class在那裏,然後Maven會爲我編譯。