开发者

How to use version control with JasperReports

We're about to start development of a number of reports using Jasper Server Reports version 3.7.0 CE.

Does anyone have any recommendations as to how best to manage version control with this development, given that the structure of the report units is managed in the database and through either iReport or the web front end?

In fact you can import/export to a directory structure using the js-import/js-export scripts, but then you can't edit t开发者_开发技巧hese files directly with iReport.

Does anyone have any pointers?


This is problematic. I have established a subversion repository to allow standard reports delivery to be versioned but it is a real pain because jasper does not make this even a little bit easy.

I created a maven project with an assembly descriptor so that "src/main/xml/resources/Reports,adhoc,Domains, etc" can be packaged up in a zip that is pushed to our maven repository.

The biggest problem is that you can't just develop adhoc and input controls merely by modifying XML files. The developer has to import what is in source control into a working jasper server, modify the reports or add new ones (after making sure that his organization and datasources are configured) and once he's satisfied that the report(s) works, export the resources to a directory or zip file, manually modify all references in the exported files from datasources and organization specific resource locations back to "generic" before checking in his changes.

When importing into jasper, the same process has to be done in reverse. The generic paths and organization values have to be converted to the developer's organization so they can be easily imported/updated and he can prove out that the full "round trip" works properly before checking in.

To make the export/subversion checkin easier, I created an ant build file which lives in the maven project's root dir. The build prompts (or will read a properties file) to determine the exported zip location, the organization id of the exported tree. It then opens exported zip file from jasper, explodes it, performs text replacements on the files, resets the "createdDate" and "updatedDate" elements to something standard (so that the developer does not end up checking in files that haven't actually changed since jasper does not preserve the date values), and then copy the files into the subversion tree.

For the import process (from the subversion tree into jasper) we have a script that takes as input the organization id and then modifies the versioned xml files to the appropriate values so that the entire tree can be easily imported/updated into their organization.

The reason this level of complexity is required is to allow us to create the same standard reports in a multi-tenant environment, plus jasper's notion of deploying reports is absolutely bizarre. I'm not sure it would be possible to make this process more difficult if you were intending to do so.


If I was in your position I would have established this kind of process:

  • end of development session: export all reports to a directory structure in a project under version control
  • commit the project
  • before next development session: synchronize the project with svn repository
  • import directory structure to Jasper Server Reports
  • continue development


Not sure if someone found posted the solution. This is what I have done for existing reports.

  1. export reports from jasper server
  2. modify file names from .data to .jrmxl
  3. modify subreport calling to add extension (like in A.jrxml should have subreport name as B.jrxml
  4. modify add .jrmxl to datafile,label and name in report unit xml files.

If you are creating new report on jasper server, it simple give .jrxml to name and label while adding jrxml file. thats it.

Now you can work same files in local and import same to jasper server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜