3

WAR 内の便利な場所にある BIRT ランタイムを使用して、Maven に WAR をアセンブルさせようとしています。

BIRT ランタイムは pom.xml にあります。

<dependency>
  <groupId>org.eclipse.birt</groupId>
  <artifactId>report-engine</artifactId>
  <version>2.3.2</version>
  <type>zip</type>
  <scope>runtime</scope>
</dependency>

これをオーバーレイすることの望ましい結果は次のようなものです

ReportEngine/lib/*           -> WEB-INF/lib 
ReportEngine/configuration/* -> WEB-INF/platform/configuration 
ReportEngine/plugins/*       -> WEB-INF/platform/plugins 

私のオーバーレイ構成は次のようになります

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <overlays>
      <overlay>
        <groupId>org.eclipse.birt</groupId>
        <artifactId>report-engine</artifactId>
        <type>zip</type>
        <includes>
          <include>ReportEngine/lib/*</include>
        </includes>
        <targetPath>WEB-INF/lib</targetPath>
      </overlay>
      <overlay>
        <groupId>org.eclipse.birt</groupId>
        <artifactId>report-engine</artifactId>
        <type>zip</type>
        <includes>
          <include>ReportEngine/configuration/*</include>
          <include>ReportEngine/plugins/*</include>
        </includes>
        <targetPath>WEB-INF/platform</targetPath>
      </overlay>
    </overlays>
  </configuration>
</plugin>

もちろん、走っmvn war:explodedているときは見ています

ReportEngine/lib/*           -> WEB-INF/lib/ReportEngine/lib/ 
ReportEngine/configuration/* -> WEB-INF/platform/configuration/ReportEngine/lib/ 
ReportEngine/plugins/*       -> WEB-INF/platform/plugins/ReportEngine/lib/

これは、同じ種類の問題に関連しています。答えはありません http://www.coderanch.com/t/447258/Ant-Maven-Other-Build-Tools/Maven-war-dependencies-moving-files

内部からすべてを機能させることで、これを少し整理する方法を指摘するためのボーナスポイントWEB-INF/birt-runtime

編集:

上記の場所が指定されている理由は、http: //wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1 に示されている場所と一致しているためです。これを模倣するために Tomcat のインストールでフリッツすると、すべてが機能するように見えます。zip を WEB-INF/birt-runtime に単純にオーバーレイし、エンジン構成を適切に設定できれば理想的ですが、まだ機能していません。

例えば:

engineConfig = new EngineConfig();
engineConfig.setEngineHome("WEB-INF/birt-runtime");
engineConfig.setPlatformContext(new PlatformServletContext(servletContext));
4

2 に答える 2

1

更新: 質問を読み直すと、テスト プロジェクトのサブディレクトリを見逃していたことがわかったので、もちろんうまくいきました。申し訳ありません。

私が知る限り、war オーバーレイまたは依存関係プラグインのいずれにも、アーティファクトのサブフォルダーをディレクトリに展開し、パスの親要素を除外するメカニズムは存在しません。どちらも完全な相対パスを提供します。

ただし、 unpack ゴールを使用してアーカイブを一時フォルダーに解凍し、antrun-pluginを使用して必要なサブフォルダーを最終的な保存場所にコピーすることができます。

次の構成はまさにそれを行います(私はまだこれをテストしていないので、省略がある場合は申し訳ありません。正確な詳細についてはドキュメントを参照してください)。実行は同じフェーズにありますが、依存関係プラグインが antrun-plugin の前に構成されている限り、それが最初に実行されることに注意してください。注意: prepare-package は Maven 2.1 の新機能です。古いバージョンを使用している場合は、別のフェーズを使用する必要があります。

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <id>unpack-lib</id>
      <phase>prepare-package</phase>
      <goals>
        <goal>unpack</goal>
      </goals>
      <configuration>
        <artifactItems>
          <artifactItem>
            <groupId>org.eclipse.birt</groupId>
            <artifactId>report-engine</artifactId>
            <version>2.3.2</version>
            <type>jar</type>
            <overWrite>false</overWrite>
          </artifactItem>
        </artifactItems>
        <!--unpack all three folders to the temporary location-->
        <includes>ReportEngine/lib/*,ReportEngine/configuration/*,ReportEngine/plugins/*</includes>
        <outputDirectory>${project.build.directory}/temp-unpack</outputDirectory>
        <overWriteReleases>false</overWriteReleases>
      </configuration>
    </execution>
  </executions>
</plugin>
  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <phase>prepare-package</phase>
        <configuration>
          <tasks>
            <!--now copy the configuration and plugin sub-folders to WEB-INf/platform-->
            <copy todir="${project.build.directory}/WEB-INF/platform">
              <fileset dir="${project.build.directory}/temp-unpack/ReportEngine/configuration"/>
              <fileset dir="${project.build.directory}/temp-unpack/ReportEngine/plugins"/>
            </copy>
            <!--copy the lib sub-folder to WEB-INf/lib-->
            <copy todir="${project.build.directory}/WEB-INF/lib">
              <fileset dir="${project.build.directory}/temp-unpack/ReportEngine/lib"/>
            </copy>
          </tasks>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
于 2009-08-26T15:11:42.870 に答える
0

上記のリッチセラーに返信して、自分の質問に実際に答えているわけではありません:)

これを で動作させようとするとmvn dependency:unpack、ドキュメントはそれを実行ノードから取り出すように言います。それが結果の原因かどうかはわかりませんが、これは結局

WEB-INF/lib/ReportEngine/lib
WEB-INF/platform/ReportEngine/configuration
WEB-INF/platform/ReportEngine/plugins

基本的に私の最初の戦争プラグインの試みと同じです。depedency-unpack を支援するためのドキュメントには何も表示されません。もう一度やってみます。

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>

      <configuration>
        <artifactItems>
          <artifactItem>
            <groupId>org.eclipse.birt</groupId>
            <artifactId>report-engine</artifactId>
            <version>2.3.2</version>
            <type>zip</type>
            <overWrite>false</overWrite>
            <!--may not be needed, need to check-->
            <outputDirectory>${project.build.directory}/WEB-INF/lib</outputDirectory>
            <includes>ReportEngine/lib/*</includes>
          </artifactItem>

          <artifactItem>
            <groupId>org.eclipse.birt</groupId>
            <artifactId>report-engine</artifactId>
            <version>2.3.2</version>
            <type>zip</type>
            <overWrite>false</overWrite>
            <!--may not be needed, need to check-->
            <outputDirectory>${project.build.directory}/WEB-INF/platform</outputDirectory>
            <includes>ReportEngine/configuration/*,ReportEngine/plugins/*</includes>
          </artifactItem>
        </artifactItems>
      </configuration>
</plugin>
于 2009-08-26T15:42:57.110 に答える