0

サードパーティのライブラリを使用している UIMA AS アプリケーションがあります。次のことを知りたいです: 1. デプロイされたアプリケーションがそれらを認識し、「ClassNotFoundException」をスローしないように、これらの 3 番目のライブラリをどこ (場所) に追加できますか? 私にとっての強引な解決策は、それらを UIMA AS "lib/" フォルダーに直接追加することでしたが、この解決策はテスト用であり、運用環境では受け入れられません。2. PEAR ファイルを生成するときに、このサード パーティ ライブラリをどのようにセットアップすれば、アプリケーションのデプロイ時にサード パーティ ライブラリが考慮され、それらをクラスパスに手動で追加する必要がなくなりますか?

私はあなたの答えを楽しみにしています。ありがとうございました。

4

2 に答える 2

1

最初の質問: 私のアプローチは 1. 3 番目のライブラリ用の lib フォルダーを作成する 2. UIMACLASSPATH に lib フォルダーを追加するスクリプトを作成する

@set UIMA_CLASSPATH=%UIMA_CLASSPATH%;../../lib;../../bin call deployAsyncService.cmd for the second question: 私は pear ファイルを生成するために maven プラグインを使用しています。

pom.xml からの抜粋 (maven 関連)

<plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <executions>
        <!-- Copy the dependencies to the lib folder for the PEAR to 
          copy -->
        <execution>
          <id>copy-dependencies</id>
          <phase>package</phase>
          <goals>
            <goal>copy-dependencies</goal>
          </goals>
          <configuration>
            <outputDirectory>${basedir}/lib</outputDirectory>
            <overWriteSnapshots>true</overWriteSnapshots>
            <includeScope>runtime</includeScope>
          </configuration>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <groupId>org.apache.uima</groupId>
      <artifactId>PearPackagingMavenPlugin</artifactId>
      <version>2.3.1</version>

      <!-- if version is omitted, then -->
      <!-- version is inherited from parent's pluginManagement section -->
      <!-- otherwise, include a version element here -->

      <!-- says to load Maven extensions (such as packaging and type 
        handlers) from this plugin -->
      <extensions>true</extensions>
      <executions>
        <execution>
          <configuration>
            <classpath>
              <!-- PEAR file component classpath settings -->
              $main_root/lib/*.jar
            </classpath>

            <mainComponentDesc>
              <!-- PEAR file main component descriptor -->
            </mainComponentDesc>

            <componentId>
              <!-- PEAR file component ID -->
              ${project.artifactId}
            </componentId>

            <datapath>
              <!-- PEAR file UIMA datapath settings -->
              $main_root/
            </datapath>

          </configuration>
          <goals>
            <goal>package</goal>
          </goals>
        </execution>
      </executions>
    </plugin>

    <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
      <executions>
        <!-- Clean the libraries after packaging -->
        <execution>
          <id>CleanLib</id>
          <phase>clean</phase>
          <configuration>
            <tasks>
              <delete quiet="false" failOnError="false">
                <fileset dir="${basedir}/lib" includes="**/*.jar" />
              </delete>
            </tasks>
          </configuration>
          <goals>
            <goal>run</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
于 2012-01-19T10:59:11.227 に答える
0

コンパイル済みのクラスを外部 jar から抽出し、UIMA コンポーネント jar にパックできます。PEAR ファイルに関しては、同様のアプローチが機能することがわかるかもしれません (pear をアンパックし、.class ファイルを追加し、再パックします)。

于 2012-07-03T02:11:28.943 に答える