0

Web アプリで yui-compressor maven プラグインを使用できません。Mavenを実行すると、次のエラーが表示されます

[情報] 目標 'net.sf.alchim:yuicompressor-maven-plugin:0.7.1:compress' を実行しているプラ​​グイン マネージャーの内部エラー: Mojo 'net.sf.alchim: をロードできません:
yuicompressor-maven-plugin:0.7.1:compress'
プラグイン「net.sf.alchim:yuicompressor-maven-plugin」で。必要なクラスがありません: org.mozilla.javascript.ErrorReporter

後で、rhino js プラグインにこのクラス org.mozilla.javascript.ErrorReporter が含まれていることがわかりました。したがって、このプラグインを依存関係タグに含めましたが、それでも同じエラーが発生します。

誰もそのようなエラーに遭遇しましたか?

--> 主な質問を更新して、po プラグインの詳細を追加します

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

3 に答える 3

0

ErrorReporter クラスが見つからないことにも苦労しました。jar-with-dependencies を構築することで解決し、それを自分の 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 がコンパイルしてくれることがわかりました。

于 2013-04-16T19:19:24.087 に答える
0

最新バージョン(1.1)をお試しいただけますか?

0.7.1 バージョンは、公式リポジトリにもないようです。多分依存関係の解決の問題ですか?

于 2010-10-12T21:43:02.027 に答える
0

jboss の Yui コンプレッサー StringIndexOutOfBoundsExceptionのトピックを参照してください。

Web アプリで yuicompressor を使用する唯一の方法は、手動で rhino の依存関係とマージすることです。それ以外の場合、実行するアプリは、クラスローダーの読み込みシーケンスで必要な jar のシーケンスを指定する必要があります (youcompressor は rhino の前に移動する必要があります)。

于 2012-01-13T15:19:51.890 に答える