문제

나는 Maven이 전쟁 내에서 유용한 위치에서 Birt 런타임과 전쟁을 조립하려고 노력하고 있습니다.

Birt 런타임은 pom.xml as에 있습니다

<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 설치로 fritz를 할 때, 그것은 모두 작동하는 것 같습니다. Zip을 Web-INF/Birt-Runtime으로 오버레이하고 엔진 구성을 적절하게 설정할 수 있지만 아직 작동하지는 않았습니다.

예 :

engineConfig = new EngineConfig();
engineConfig.setEngineHome("WEB-INF/birt-runtime");
engineConfig.setPlatformContext(new PlatformServletContext(servletContext));
도움이 되었습니까?

해결책

업데이트 : 질문을 다시 읽을 때 테스트 프로젝트에서 하위 디렉토리를 놓쳤다는 것을 알았으므로 물론 저에게 효과적이었습니다. 죄송합니다.

내가 아는 한, 전쟁 오버레이 또는 종속성 플러그 인 아티팩트의 서브 폴더를 디렉토리에 포장하고 경로의 부모 요소를 배제하기위한 메커니즘이 존재하지 않는다. 둘 다 완전한 상대 경로를 제공 할 것이다.

그러나 포장 풀 목표를 사용하여 아카이브를 임시 폴더로 포장 한 다음 앤트 런-플루인 필요한 서브 폴더를 최종 휴식 장소에 복사합니다.

다음 구성은 그 일을 수행합니다 (아직 테스트하지 않았으므로 누락이 있으면 사과하지 않았으므로 정확한 세부 사항은 문서를 참조하십시오). 참고 실행은 같은 단계에 있지만, 종속성-플러그 인이 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

기본적으로 나의 초기 전쟁 플루그 인 시도와 동일합니다. Docs에서 Depedency-unpack을 지원할 수있는 것은 없습니다. 다시 시도하겠습니다. 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