سؤال

أحاول الحصول على مافن لتجميع حرب مع وقت تشغيل BIRT في موقع مفيد داخل الحرب.

وقت تشغيل 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-man-build-tools/maven-war-dependation-moving-files.

نقاط المكافأة للإشارة إلى كيفية ترتيب هذا الأمر قليلا من خلال جعل كل شيء يعمل من الداخل WEB-INF/birt-runtime

تعديل:

سبب المواقع المحددة أعلاه هي أنها تتطابق مع تلك المشار إليها في http://wiki.eclipse.org/servlet_example_٪28Birt٪29_2.1. وعندما أنا فريتز مع تثبيت Tomcat لتقليد هذا، يبدو أن كل شيء يعمل. سيكون مثاليا إذا استطعت ببساطة تراكب الرمز البريدي إلى وقت التشغيل Web-Inf / Birt، ثم قم بتعيين تكوين المحرك بشكل مناسب، لكنني لم أجد ذلك للعمل حتى الآن.

على سبيل المثال:

engineConfig = new EngineConfig();
engineConfig.setEngineHome("WEB-INF/birt-runtime");
engineConfig.setPlatformContext(new PlatformServletContext(servletContext));
هل كانت مفيدة؟

المحلول

تحديث: عند إعادة قراءة السؤال الذي أدرك أنني فاتني الدلائل الفرعية من مشروع الاختبار الخاص بي، وبالطبع العمل بالنسبة لي، آسف لذلك.

بقدر ما أعرف، لا يوجد أي آلية إما تراكب الحرب أو المكون الإضافي للاعتماد على المجلدات الفرعية من القطع الأثرية إلى دليل واستبعاد العناصر الأصلية للمسار، كلاهما سيعطيك المسار النسبي الكامل.

ومع ذلك، يمكنك استخدام هدف Unpack لتفكير الأرشيف إلى مجلد مؤقت، ثم استخدم Antrun- البرنامج المساعد لنسخ المجلدات الفرعية المطلوبة إلى أماكن الراحة النهائية.

سيقوم التكوين التالي بذلك فقط (لم أختبر ذلك بعد الاعتذار حتى إذا كان هناك أي إغفال، راجع الوثائق للحصول على التفاصيل الدقيقة). ملاحظة يتم تنفيذ عمليات الإعدام في نفس المرحلة، ولكن طالما تم تكوين المساعد المكون من التبعية قبل أن يتم تنفيذ برنامج Antrun-Plugin أولا. ملاحظة، حزمة التحضير جديدة بالنسبة ل 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>

نصائح أخرى

لا يجيب حقا على سؤالي، والاستجابة للبائع الأثرياء أعلاه :)

محاولة للحصول على هذا للعمل مع mvn dependency:unpack, ، يقول المستندات لإخراج العقدة من عمليات الإعدام. لست متأكدا إذا كان هذا هو سبب النتيجة، ولكن هذا ينتهي مع

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

في الأساس نفس محاولة مكونات الحرب الأولية الخاصة بي. لا أرى أي شيء في المستندات لتفكيك Seependence للمساعدة. سأحاول مرة أخرى TMRW.

<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>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top