2013-10-21 1 views
2

컴파일 나는 JasperReports를의 JRXML 파일에 몇 가지 사용자 정의 자바 클래스를 가져올 수 있습니다.
나는가져 오기 사용자 정의 클래스 jrxml 및 Maven 플러그인

<import value="org.ga.jasper.sample.MyCustomClass"/> 

를 사용하여이 완벽하게 잘 작동하고 나는이 jrxml를 실행하고 내 코드를 테스트 할 수 있어요 그렇게 할 수 있어요. 내가 JasperReports를-받는다는 - 플러그인를 사용하여을 .jasper 파일에이 사전 컴파일 할 때

문제가 온다.

빌드를 수행 할 때 내 패키지를 찾지 못해 가져 오기가 잘못되었다는 메시지가 표시됩니다.

package org.ga.jasper.sample does not exist 
import org.ga.jasper.sample.MyCustomClass; 

참고로, 내 자바 코드와 은 .jrxml 같은 받는다는 모듈에 있지만 다른 폴더에 있습니다. 현재 모듈의 클래스가 컴파일되기 전에 다음

, 기본적으로

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>jasperreports-maven-plugin</artifactId> 
    <executions> 
     <execution> 
      <goals> 
       <goal>compile-reports</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <sourceDirectory>src/main/resources/jasper</sourceDirectory> 
     <outputDirectory>${project.build.directory}/jasper</outputDirectory> 
     <compiler>net.sf.jasperreports.engine.design.JRJavacCompiler</compiler> 
    </configuration> 
    <dependencies> 
     <dependency> 
      <groupId>net.sf.jasperreports</groupId> 
      <artifactId>jasperreports</artifactId> 
      <version>4.5.1</version> 
     </dependency> 
    </dependencies> 
</plugin> 

답변

1

이 내가 문제를 해결하는 방법을 여기에 페이지의 하단에있는 정보를 참조하십시오 . 단계 추가

  <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>jasperreports-maven-plugin</artifactId> 
      <executions> 
      <execution> 
        <phase>compile</phase> 
        <goals> 
        <goal>compile-reports</goal> 
        </goals> 
      </execution> 
      </executions> 
      <configuration> 
      <sourceDirectory>src/main/resources/jasper</sourceDirectory> 
      <outputDirectory>${project.build.directory}/jasper</outputDirectory> 
       <compiler>net.sf.jasperreports.engine.design.JRJavacCompiler</compiler> 
      </configuration> 
      <dependencies> 
      <dependency> 
      <groupId>net.sf.jasperreports</groupId> 
      <artifactId>jasperreports</artifactId> 
      <version>4.5.1</version> 
      </dependency> 
      </dependencies> 
     </plugin> 
+0

변경 한 구성 필드를 설명 할 수 있습니까? – katwekibs

관련 문제