jasper를 얻기 위해 jrxml을 어떻게 컴파일합니까?
개미에서 어떻게 컴파일 할 은 .jrxml 의 GET에 파일 을 .jasper을 ?
jrxml을 jasper로 컴파일하는 방법에는 세 가지가 있습니다.
iReport 디자이너의 컴파일 버튼 (해머 로고)을 통해 직접 컴파일 할 수 있습니다.
Ant Compile Sample에 표시된대로 ant를 사용하여 컴파일 할 수 있습니다 .
<target name="compile1"> <mkdir dir="./build/reports"/> <jrc srcdir="./reports" destdir="./build/reports" tempdir="./build/reports" keepjava="true" xmlvalidation="true"> <classpath refid="runClasspath"/> <include name="**/*.jrxml"/> </jrc> </target>아래는 현재 프로젝트에 대한 보고서 컴파일 작업입니다.

Daniel Rikowski의 추가 :
JasperCompileManager 클래스를 사용하여 Java 코드에서 컴파일 할 수도 있습니다 .
JasperCompileManager.compileReportToFile( "our_jasper_template.jrxml", // the path to the jrxml file to compile "our_compiled_template.jasper"); // the path and name we want to save the compiled file to
Jaspersoft Studio (iReports를 대체하고 있다고 생각합니다. 이클립스를 기반으로 한 매우 유사하고 여전히 프리웨어 임) 를 사용하는이 질문을 접하는 사람은 .NET 의 편집기 영역 상단에있는 "Compile Report"아이콘을 찾으십시오. jrxml 파일. 아이콘 줄의 첫 번째 아이콘은 이진수가있는 파일입니다 (최소 버전 5.6.2에서는).

이 아이콘을 클릭하면 .jrxml 파일과 동일한 디렉토리에 .jasper 파일이 생성됩니다.
maven에서는 자동입니다.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<configuration>
<outputDirectory>target/${project.artifactId}/WEB-INF/reports</outputDirectory>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
<inherited>false</inherited>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.7.6</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<type>jar</type>
</dependency>
</dependencies>
jasper 파일을 생성하기 위해 iReport 2.0.2를 사용하고 있습니다.
망치 로고를 찾지 못했지만 create > compile메뉴 모음에 iReport 프로그램 파일 폴더에 jasper 파일을 만드는 메뉴가 있습니다.
IReport 로그 : "컴파일 버전은 fichier .... \ SalesOrderItemsSubreportA4.jasper-> C : \ Program Files \ JasperSoft \ iReport-2.0.2 \ SalesOrderItemsSubreportA4.java"
iReport 디자이너 5.6.0을 사용하여 미리보기없이 여러 jrxml 파일을 컴파일하려면 도구-> 대량 처리 도구로 이동합니다. 정교화 유형을 "파일 컴파일"로 선택하고 모든 jrxml 보고서가 저장된 폴더를 선택한 다음 일괄 적으로 컴파일합니다.
iReport를 사용한다면 쉽게 할 수 있습니다.
- 미리보기를 클릭하면 자동으로 컴파일됩니다.
- 그것을 준수하는 옵션이 있습니다. 페이지를 선택하여 컴파일 할 수 있으며 오른쪽 클릭하면 컴파일 옵션이 나타납니다.
일식에서
- Eclipse 용 Jaspersoft Studio 를 설치합니다 .
.jrxml파일을 마우스 오른쪽 버튼으로 클릭하고Open with JasperReports Book Editor- 파일
Design탭을 엽니 다.jrxml. - 창 상단에
Compile Report아이콘이 표시됩니다.
버전 5.1.0 사용 :
미리보기를 클릭하면 동일한 작업 디렉토리에 YourReportName.jasper가 생성됩니다.
- iReport Designer에서 .jrxml 파일을 엽니 다.
- 보고서 검사기를 엽니 다 (창-> 보고서 검사기).
- Inspector 상단에서 보고서 이름을 마우스 오른쪽 버튼으로 클릭 한 다음 "Compile Report"를 클릭합니다.
보고서가 자동으로 컴파일되도록 미리 볼 수도 있습니다.
**A full example of POM file**.
Command to Build All **Jrxml** to **Jasper File** in maven
If you used eclipse then right click on the project and Run as maven Build and add goals antrun:run@compile-jasper-reports
compile-jasper-reports is the id you gave in the pom file.
**<id>compile-jasper-reports</id>**
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.jasper</groupId>
<artifactId>testJasper</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TestJasper</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.3.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.6</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>compile-jasper-reports</id>
<goals>
<goal>run</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<target>
<echo message="Start compile of jasper reports" />
<mkdir dir="${project.build.directory}/classes/reports"/>
<echo message="${basedir}/src/main/resources/jasper/jasperreports" />
<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask"
classpathref="maven.compile.classpath" />
<jrc srcdir="${basedir}/src/main/resources/jasper/jasperreports" destdir="${basedir}/src/main/resources/jasper/jasperclassfile"
xmlvalidation="true">
<classpath refid="maven.compile.classpath"/>
<include name="**/*.jrxml" />
</jrc>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
참고 URL : https://stackoverflow.com/questions/4456779/how-do-i-compile-jrxml-to-get-jasper
'Nice programing' 카테고리의 다른 글
| Eclipse 편집기 : Dos에서 Unix로 파일 형식을 변경하는 방법 (0) | 2020.11.17 |
|---|---|
| GIS : PostGIS / PostgreSQL vs. MySql vs. SQL Server? (0) | 2020.11.17 |
| fetch vs. [] when working with hashes? (0) | 2020.11.16 |
| Why does Java let you cast to a collection? (0) | 2020.11.16 |
| C# Convert a Base64 -> byte[] (0) | 2020.11.16 |