Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Question about classpath #54

Open
ghost opened this issue Oct 7, 2019 · 3 comments
Open

Question about classpath #54

ghost opened this issue Oct 7, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 7, 2019

Hi,

I've written java classes to use jasperreport-function. In the same project I'm using maven and your pluging. I need to add the jasperreports-function to the classpath of the plugin.

<groupId>net.sf.jasperreports</groupId> <artifactId>jasperreports-functions</artifactId> <version>6.10.0</version>

Any ideas who to proceed?

I've been trying to use the classpath configuration of the plugin, but can't seem to make it work. Any idea in how to proceed?

<plugin> <groupId>com.alexnederlof</groupId> <artifactId>jasperreports-plugin</artifactId> <version>2.3</version> <configuration> <sourceDirectory>${project.basedir}/src/main/jasperreports</sourceDirectory> <outputDirectory>${project.build.outputDirectory}/jasperreports</outputDirectory> <verbose>true</verbose> <classpathElements><element>net.sf.jasperreports.jasperreports-functions</element></classpathElements> </configuration> </plugin>

@alexnederlof
Copy link
Owner

I'm not sure what you're trying to achieve. If you're new to Maven/Java: Don't forget that you need to set Jasper as a <dependency> as well in Maven. Besides that, you can use this plugin to compile the reports.

@ghost
Copy link
Author

ghost commented Oct 8, 2019

So yeah, I have defined a Java project that uses jasperreports-functions as dependencies because I've written a custom function that can be used in the Expression Editor (in Jaspersoft Studio like SUM or TODAY). When at compile time I want to create my jasper file with the plugin. I get an error because it cannot find my custom function. I think I have to add the dependency to the classpath of the plugin, like it mentions in the in your readme file. But I can't seem to get it work. (It is already added as one of the dependencies of the plugin)

If that happens, than at compile time my .java files get compiled to .class files and after the compile phase (process-classes) I use the plugin to compile the reports. So the .jrxml can use the compiled java classes to convert it correctly to .jasper files.

So my question is, how do I add the jasperreports-functions to the classpath of the plugin. I already defined them as dependencies. Or do I need to find another way?

@ghost
Copy link
Author

ghost commented Oct 8, 2019

Some more information. I think the jasperreports-functions is on the classpath. So maybe that's not the problem...

I've followed the following tutorial and have no problem compiling a .jasper file in the Jaspersoft Studio. https://community.jaspersoft.com/wiki/jaspersoft-studio-expression-editor-how-extend-it-and-contribute-your-own-functions-part-2-0

I've defined a custom function and now I'm moving the project to Intellij. I'm using your plugin to compile the jasper file. But running into errors that my function is not recognized. Any information in how to go ahead with this? I've tried adding jasperreport-functions as dependency, but no help and tried running it after the compile phase after my classes are compiled. Any ideas?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant