私はgrailsアプリケーションを持っています。 .jrxml
のレポート src/reports
。 jasperコンパイラでファイルを指すことができるため、これは正常に機能します。ただし、現在はレポートをローカライズする必要があり、各レポートには独自のローカライズが必要です。
このようなパッケージがあります src/reports
:
com.stefankendall.blah.blah
com.stefankendall.a.b
com.stefankendall.c
iReport 4.0.2では、クラスパスで各バンドルの正確なフォルダーを指定できますが、実行中のgrailsアプリケーション内でこれを実行できますか?
一緒にドキュメントをスクレイピング、私はこれを持っています:
src/reports/com/stefankendall/a/report1.jrxml
src/reports/com/stefankendall/a/report1_Bundle/report1.properties, report1_en_US.properties...
実行中のアプリケーションでは、 report_Bundle
クラスパス上にないように見えるので、ジャスパーは爆弾を報告します。Groovyでジャスパーを呼び出すときに、このパスを指定する方法はありますか?または、何らかの形で追加できますか src/reports
レポートからクラスパスとドリルダウンに何らかの方法で?
回答:
回答№1は0もっと良い方法があるかもしれませんが、...
_Events.groovy:
eventClasspathStart = {
addResourceBundlesToClasspath()
}
private def addResourceBundlesToClasspath(){
classpathSet = false
File reportsDir = new File("src/reports")
reportsDir.eachDirRecurse { File directory ->
if( directory.name.endsWith("_Bundle") ){
println "Adding ${directory.getAbsolutePath()} to classpath"
rootLoader.addURL( directory.toURL() )
}
}
}