Hot questions for Using JasperReports in maven

Question:

In order to have an executable jar I include the maven dependencies. Everything works fine but the jasperreports_extension.properties. Jasper already has a default one that replaces mine.

I'd like to know how to combine both files (the default and custom one) into the jar file. Actually I have manually combined both settings and now I want to find the way to replace the file that assembly plugin copies with the merged one I already have.

This is my current maven assembly plugin settings:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${maven-assembly-plugin.version}</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>
                            com.test.sample.MainClass
                        </mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
    </plugins>
</build>

These are my custom settings to add some fonts to the reports:

net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory 
net.sf.jasperreports.extension.simple.font.families.ireportfamily1453367638844=fonts/fontsfamily1453367638844.xml

And the dependency:

<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>6.2.0</version>
</dependency>

EDIT:

Considering the dependencies:

  • jasperreports_extension.properties is inside (root level) the jasperreports-6.2.0.jar
  • jasperreports_extension.properties is inside (root level) the jasperreports-fonts-6.0.0.jar (this is only a Test Dependencies)

After I replaced the assembly plugin by shade one, the initial issue I reported is fixed, however I got this new one:

    Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: no manifiest section for signature file entry org/bouncycastle/mail/smime/SMIMEEnvelopedGenerator$EnvelopedGenerator.class
        at sun.security.util.SignatureFileVerifier.verifySection(Unknown Source)
        at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
        at sun.security.util.SignatureFileVerifier.process(Unknown Source)
        at java.util.jar.JarVerifier.processEntry(Unknown Source)
        at java.util.jar.JarVerifier.update(Unknown Source)
        at java.util.jar.JarFile.initializeVerifier(Unknown Source)
        at java.util.jar.JarFile.getInputStream(Unknown Source)
        at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
        at sun.misc.Resource.cachedInputStream(Unknown Source)
        at sun.misc.Resource.getByteBuffer(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

I solved this signature problem following this: "Invalid signature file" when attempting to run a .jar


Answer:

I'm assuming from your question that you have a file called jasperreports_extension.properties as a resource of your project, located inside src/main/resources. Because you have a dependency on jasperreports that also happens to have a resource called jasperreports_extension.properties at the root of the classpath, one is overwriting the other when you are making the jar-with-dependencies.

To tackle this problem, you should drop the maven-assembly-plugin and use maven-shade-plugin instead. This plugin provides out of the box a transformer that is able to merge two properties file together: by merging, I mean that one of the file is appended to the end of the other one:

Some jars contain additional resources (such as properties files) that have the same file name. To avoid overwriting, you can opt to merge them by appending their content into one file.

In this case, a sample configuration would be:

<plugin>
  <artifactId>maven-shade-plugin</artifactId>
  <version>2.4.3</version>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <transformers>
          <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
            <resource>jasperreports_extension.properties</resource>
          </transformer>
          <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
            <mainClass>com.test.sample.MainClass</mainClass>
          </transformer>
        </transformers>
        <createDependencyReducedPom>false</createDependencyReducedPom>
      </configuration>
    </execution>
  </executions>
</plugin>

This will produce a final fat JAR where the content of jasperreports_extension.properties will be the content of your file and the file coming from the dependency.

Also, it will also have a correct MANIFEST since we specified to the plugin which class was the main class.


As a side note, when you are making fat JAR, the maven-assembly-plugin only provides basic support. From their homepage:

If your project wants to package your artifact in an uber-jar, the assembly plugin provides only basic support. For more control, use the Maven Shade Plugin.

Question:

I'm developing a java web app that uses Jasper report to show some report. Now some version changes at my depencencies I'm getting the following error:

net.sf.jasperreports.engine.JRRuntimeException: java.io.IOException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
at net.sf.jasperreports.renderers.BatikRenderer.ensureSvg(BatikRenderer.java:229)
at net.sf.jasperreports.renderers.BatikRenderer.ensureSvg(BatikRenderer.java:239)
at net.sf.jasperreports.renderers.BatikRenderer.getDimension(BatikRenderer.java:157)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:1434)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:854)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:818)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:695)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:396)
at net.sf.jasperreports.engine.JasperExportManager.exportToPdfStream(JasperExportManager.java:191)
at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(JasperExportManager.java:527)

I think that the error could be due from build path. This is my dependency tree:

    [INFO] ------------------------------------------------------------------------
[INFO] Building vaadin-webapp-billing 2.3.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ vaadin-webapp-billing ---
[INFO] it.mycompany:vaadin-webapp-billing:war:2.3.7-SNAPSHOT
[INFO] +- it.mycompany:services-billing:jar:2.3.7-SNAPSHOT:compile
[INFO] |  +- it.mycompany:util-billing:jar:2.3.7-SNAPSHOT:compile
[INFO] |  |  +- it.mycompany:model-billing:jar:2.3.7-SNAPSHOT:compile
[INFO] |  |  |  +- org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.5.1:compile
[INFO] |  |  |  |  +- org.eclipse.persistence:javax.persistence:jar:2.1.0:compile
[INFO] |  |  |  |  +- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.5.1:compile
[INFO] |  |  |  |  +- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.5.1:compile
[INFO] |  |  |  |  +- org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.5.1:compile
[INFO] |  |  |  |  \- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.5.1:compile
[INFO] |  |  |  +- org.eclipse.persistence:eclipselink:jar:2.5.1:compile
[INFO] |  |  |  |  \- org.eclipse.persistence:commonj.sdo:jar:2.1.1:compile
[INFO] |  |  |  \- com.oracle:ojdbc14:jar:14.0.0:compile
[INFO] |  |  +- org.apache.poi:poi-ooxml:jar:3.7:compile
[INFO] |  |  |  +- org.apache.poi:poi:jar:3.7:compile
[INFO] |  |  |  +- org.apache.poi:poi-ooxml-schemas:jar:3.7:compile
[INFO] |  |  |  |  \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] |  |  |  \- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  +- com.lowagie:itext:jar:2.1.7.js1:compile
[INFO] |  |  \- it.mycompany:vaadin-common-component:jar:1.0.0:compile
[INFO] |  |     \- org.springframework.data:spring-data-jpa:jar:1.2.0.RELEASE:compile
[INFO] |  |        +- org.springframework.data:spring-data-commons-core:jar:1.4.0.RELEASE:compile
[INFO] |  |        \- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
[INFO] |  +- org.springframework:spring-aop:jar:4.1.4.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-aspects:jar:4.1.4.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.4:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.1.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:4.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:4.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:4.1.4.RELEASE:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:4.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-orm:jar:4.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-tx:jar:4.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-web:jar:4.1.4.RELEASE:compile
[INFO] |  +- org.aspectj:aspectjrt:jar:1.7.1:compile
[INFO] |  +- org.aspectj:aspectjtools:jar:1.7.1:compile
[INFO] |  +- net.sf.jasperreports:jasperreports:jar:5.0.0:compile
[INFO] |  |  +- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] |  |  +- commons-digester:commons-digester:jar:2.1:compile
[INFO] |  |  +- jfree:jcommon:jar:1.0.15:compile
[INFO] |  |  +- jfree:jfreechart:jar:1.0.12:compile
[INFO] |  |  +- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] |  |  +- org.codehaus.castor:castor:jar:1.2:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.0.5:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.0.5:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.0.5:compile
[INFO] |  +- net.sf.jasperreports:jasperreports-fonts:jar:4.0.0:compile
[INFO] |  +- commons-io:commons-io:jar:2.4:compile
[INFO] |  +- net.sf.barcode4j:barcode4j:jar:2.1:compile
[INFO] |  |  +- avalon-framework:avalon-framework-impl:jar:4.2.0:compile
[INFO] |  |  +- commons-cli:commons-cli:jar:1.0:compile
[INFO] |  |  \- org.apache.ant:ant:jar:1.7.1:compile
[INFO] |  |     \- org.apache.ant:ant-launcher:jar:1.7.1:compile
[INFO] |  +- org.codehaus.groovy:groovy-all:jar:2.2.1:compile
[INFO] |  +- it.mycompany.fonts:custom-fonts-jasper:jar:1.0:compile
[INFO] |  +- net.sourceforge.barbecue:barbecue:jar:1.5-beta1:compile
[INFO] |  +- batik:batik-bridge:jar:1.6-1:compile
[INFO] |  |  +- batik:batik-gvt:jar:1.6-1:compile
[INFO] |  |  |  \- batik:batik-awt-util:jar:1.6-1:compile
[INFO] |  |  |     \- batik:batik-util:jar:1.6-1:compile
[INFO] |  |  |        \- batik:batik-gui-util:jar:1.6-1:compile
[INFO] |  |  |           \- batik:batik-ext:jar:1.6-1:compile
[INFO] |  |  |              \- xml-apis:xmlParserAPIs:jar:2.0.2:compile
[INFO] |  |  +- batik:batik-script:jar:1.6-1:compile
[INFO] |  |  |  \- rhino:js:jar:1.5R4.1:compile
[INFO] |  |  \- batik:batik-svg-dom:jar:1.6-1:compile
[INFO] |  |     +- batik:batik-dom:jar:1.6-1:compile
[INFO] |  |     |  +- batik:batik-css:jar:1.6-1:compile
[INFO] |  |     |  \- batik:batik-xml:jar:1.6-1:compile
[INFO] |  |     \- batik:batik-parser:jar:1.6-1:compile
[INFO] |  +- xerces:xercesImpl:jar:2.9.0:compile
[INFO] |  +- org.springframework.data:spring-data-jdbc-core:jar:1.0.0.RELEASE:compile
[INFO] |  |  \- org.springframework.retry:spring-retry:jar:1.0.0.RELEASE:compile
[INFO] |  +- org.springframework.data:spring-data-oracle:jar:1.0.0.RELEASE:compile
[INFO] |  +- com.google.collections:google-collections:jar:1.0:compile
[INFO] |  +- net.sf.opencsv:opencsv:jar:2.0:compile
[INFO] |  +- it.mycompany:csv-validator:jar:1.0.0:compile
[INFO] |  +- javax.mail:mail:jar:1.4.7:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  +- com.sun.xml.bind:jaxb-xjc:jar:2.2.5:compile
[INFO] |  \- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- com.vaadin:vaadin-bom:pom:7.5.5:import
[INFO] +- com.vaadin:vaadin-client:jar:7.5.5:provided
[INFO] |  +- com.vaadin:vaadin-shared:jar:7.5.5:compile
[INFO] |  |  +- com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile
[INFO] |  |  +- com.vaadin.external.streamhtmlparser:streamhtmlparser-jsilver:jar:0.0.10.vaadin1:compile
[INFO] |  |  \- com.vaadin.external.google:guava:jar:16.0.1.vaadin1:compile
[INFO] |  +- org.w3c.css:sac:jar:1.3:compile
[INFO] |  +- javax.validation:validation-api:jar:1.0.0.GA:provided
[INFO] |  \- javax.validation:validation-api:jar:sources:1.0.0.GA:provided
[INFO] +- com.vaadin:vaadin-server:jar:7.5.5:compile
[INFO] |  +- com.vaadin:vaadin-sass-compiler:jar:0.9.12:compile
[INFO] |  \- org.jsoup:jsoup:jar:1.8.1:compile
[INFO] +- com.vaadin:vaadin-themes:jar:7.5.5:compile
[INFO] +- org.vaadin.addon:easyuploads:jar:7.4.2:compile
[INFO] |  \- org.vaadin:viritin:jar:1.35:compile
[INFO] |     +- org.vaadin.addon:confirmdialog:jar:2.1.2:compile
[INFO] |     +- org.commonjava.googlecode.markdown4j:markdown4j:jar:2.2-cj-1.0:compile
[INFO] |     +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] |     \- javax.el:javax.el-api:jar:2.2.4:compile
[INFO] +- org.vaadin.addons:wizards-for-vaadin:jar:1.1.0:compile
[INFO] +- org.vaadin.addons:filteringtable:jar:0.9.13.v7:compile
[INFO] |  \- org.vaadin.addons:popupbutton:jar:2.5.0:compile
[INFO] +- com.vaadin:vaadin-push:jar:7.5.5:compile
[INFO] |  \- com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.2.7.vaadin1:compile
[INFO] |     \- com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile
[INFO] +- com.vaadin.addon:vaadin-charts:jar:1.1.7:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.2:compile
[INFO] +- ru.xpoft.vaadin:spring-vaadin-integration:jar:3.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO] +- org.iban4j:iban4j:jar:2.1.1:compile
[INFO] \- com.google.code.maven-scm-provider-svnjava:maven-scm-provider-svnjava:jar:2.0.6:compile
[INFO]    +- org.apache.maven.scm:maven-scm-provider-svn-commons:jar:1.8:compile
[INFO]    |  \- org.apache.maven.scm:maven-scm-api:jar:1.8:compile
[INFO]    +- org.tmatesoft.svnkit:svnkit:jar:1.7.8:compile
[INFO]    |  +- org.tmatesoft.sqljet:sqljet:jar:1.1.6:compile
[INFO]    |  |  \- org.antlr:antlr-runtime:jar:3.4:compile
[INFO]    |  +- de.regnis.q.sequence:sequence-library:jar:1.0.2:compile
[INFO]    |  \- com.trilead:trilead-ssh2:jar:1.0.0-build215:compile
[INFO]    +- net.java.dev.jna:jna:jar:3.2.2:compile
[INFO]    +- org.codehaus.plexus:plexus-utils:jar:3.0.14:compile
[INFO]    \- commons-lang:commons-lang:jar:2.6:compile

Can you give me some suggestion about this error?


Answer:

It surely has to do with xerces hell..., I see you have the xercesImpl.jar on classpath that has this class, but you got also other libraries including this class as xmlParserAPIs.jar, try to remove one of them I would remove the xercesImpl.jar.

Check out this... Dealing with "Xerces hell" in Java/Maven?

Question:

I am using JasperReports 6.3.1 with a Dropwizard 1.0.5 project and it seems to have a conflict with Jackson when desalinizing my JSON response.

I am getting:

Stacktrace:
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:462)
....
Caused by: org.apache.jasper.JasperException

and

Stacktrace:
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
...
Caused by: org.apache.jasper.el.JspELException
...
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectReader.getConfig()Lcom/fasterxml/jackson/databind/DeserializationConfig;

I tried excluding jackson-core from my Maven dependency but it won't do the trick. As I see, Jasper uses 2.1.4 and Dropwizard uses 2.7.8

<dependency>
      <groupId>net.sf.jasperreports</groupId>
      <artifactId>jasperreports</artifactId>
      <version>6.3.1</version>
      <exclusions>
        <exclusion>
          <artifactId>jackson-core-asl</artifactId>
          <groupId>org.codehaus.jackson</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

Answer:

I solved my problem. The issue was that as I was using a Dropwizard application (v 1.0.5), which was coming with jackson 2.7.8.

JasperReports is also using jackson, but it uses 2.1.4.

When deserializing the JSON objects, it was using JasperReports's library (v 2.1.4) which didn't have all the needed functions.

I solved this by adding the jackson library (core and annotations) in my pom.xml.

         <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.7.8</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.7.8</version>
        </dependency>

Question:

I have a java rest service that returns a generated PDF out of a jasper file. For some bussiness rules, the compiled .jasper files will not be on the service, only the .jxrml files. I compile the report at runtime using this line

JasperReport report = JasperCompileManager.compileReport(fileName);

This is the original section of the subreport with the reference to the compiled .jasper file

        <subreport isUsingCache="false">
            <reportElement x="57" y="30" width="498" height="15" isRemoveLineWhenBlank="true" uuid="5b26c250-7d4d-4ddb-9fdc-834a98fc6eac"/>
            <subreportParameter name="fecha">
                <subreportParameterExpression><![CDATA[$F{recorridodato_Fecha}]]></subreportParameterExpression>
            </subreportParameter>
            <subreportParameter name="idRuta">
                <subreportParameterExpression><![CDATA[$F{ruta_RutaId}.longValue()]]></subreportParameterExpression>
            </subreportParameter>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "subreport.jasper"]]></subreportExpression>
        </subreport>

This is what I read somewhere (I can't remember where) that I should do

        <subreport isUsingCache="false">
            <reportElement x="57" y="30" width="498" height="15" isRemoveLineWhenBlank="true" uuid="5b26c250-7d4d-4ddb-9fdc-834a98fc6eac"/>
            <subreportParameter name="fecha">
                <subreportParameterExpression><![CDATA[$F{recorridodato_Fecha}]]></subreportParameterExpression>
            </subreportParameter>
            <subreportParameter name="idRuta">
                <subreportParameterExpression><![CDATA[$F{ruta_RutaId}.longValue()]]></subreportParameterExpression>
            </subreportParameter>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            <subreportExpression><![CDATA[JasperCompileManager.compileReport(getClass().getResource($P{SUBREPORT_DIR} + "subreport.jrxml").openStream())]]></subreportExpression>
        </subreport>

The second options works when the report is called from within iReport. Howhever, it fails when called from the service. The generated PDF does not print the subreport data. The first option works OK both on iReport and on the REST service call, but it references the compiled .jasper file, which will not be accesible. So I need to generate the global report in Java by referencing the .jrxml subreport path only (not the .jasper file) I am using these maven references

                <!-- Jasper-->
    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>5.6.0</version>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.jexcelapi</groupId>
        <artifactId>jxl</artifactId>
        <version>2.6.12</version>
    </dependency>

Answer:

I found out a way thanks to this post

Jasper Reports: How to compile subreports

Basically it involves reading the jrxml file to detect the subreports and compile them to the physical path the .jasper should be.

Question:

This is the default generated pom.xml.

<?xml version="1.0" encoding="UTF-8"?>

<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>br.com.infox</groupId>
<artifactId>prjInfoXFX</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>prjInfoXFX</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <mainClass>br.com.infox.prjinfoxfx.MainApp</mainClass>
</properties>

<organization>
    <!-- Used as the 'Vendor' for JNLP generation -->
    <name>Your Organisation</name>
</organization>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>unpack-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <excludeScope>system</excludeScope>
                        <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                        <outputDirectory>${project.build.directory}/classes</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <id>unpack-dependencies</id>

                    <phase>package</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>${java.home}/../bin/javafxpackager</executable>
                        <arguments>
                            <argument>-createjar</argument>
                            <argument>-nocss2bin</argument>
                            <argument>-appclass</argument>
                            <argument>${mainClass}</argument>
                            <argument>-srcdir</argument>
                            <argument>${project.build.directory}/classes</argument>
                            <argument>-outdir</argument>
                            <argument>${project.build.directory}</argument>
                            <argument>-outfile</argument>
                            <argument>${project.build.finalName}.jar</argument>
                        </arguments>
                    </configuration>
                </execution>
                <execution>
                    <id>default-cli</id>
                    <goals>
                        <goal>exec</goal>                            
                    </goals>
                    <configuration>
                        <executable>${java.home}/bin/java</executable>
                        <commandlineArgs>${runfx.args}</commandlineArgs>
                    </configuration>
                </execution>
            </executions>  
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArguments>
                    <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.16</version>
            <configuration>
                <additionalClasspathElements>
                    <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
                </additionalClasspathElements>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>com.jfoenix</groupId>
        <artifactId>jfoenix</artifactId>
        <version>8.0.4</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.46</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.25</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.2.5.Final</version>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>6.5.1</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>unknown-jars-temp-repo</id>
        <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
        <url>file:${project.basedir}/lib</url>
    </repository>
</repositories>

I added a JasperReports Maven dependency and now my project don't run anymore.

Error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project prjInfoXFX: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

If I remove the JasperReports dependency, the Maven project run.

Could you help?

Edit: I tried do change the repositories, but dont work. I posted the pom.xml exec plugin config.

Edit: When i try to run got this: "Error: Could not find or load a main class prjInfoXFX-1.0.jar".

Edit: The full stack trace of the errors:

Picked up _JAVA_OPTIONS:   -Dawt.useSystemAAFontSettings=gasp
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 10:51:28-0300)
Maven home: /home/maicon/netbeans-8.2/java/maven
Java version: 1.8.0_172, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.8.0_172/jre
Default locale: pt_BR, platform encoding: UTF-8
OS name: "linux", version: "4.14.0-deepin2-amd64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /home/maicon/netbeans-8.2/java/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/maicon/.m2/settings.xml
[DEBUG] Using local repository at /home/maicon/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /home/maicon/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.065s
[INFO] Finished at: Fri May 11 00:52:35 BRT 2018
[INFO] Final Memory: 6M/119M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:104)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException

Answer:

Check your pom with these dependencies, I have also tried copying it from somewhere:

<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>3.7.6</version>
    <type>jar</type>
    <scope>compile</scope>
    <exclusions>
        <exclusion>
            <artifactId>commons-collections</artifactId>
            <groupId>commons-collections</groupId>
        </exclusion>
        <exclusion>
            <artifactId>commons-beanutils</artifactId>
            <groupId>commons-beanutils</groupId>
        </exclusion>
        <exclusion>
            <artifactId>commons-digester</artifactId>
            <groupId>commons-digester</groupId>
        </exclusion>
        <exclusion>
            <artifactId>commons-logging</artifactId>
            <groupId>commons-logging</groupId>
        </exclusion>
    </exclusions>
</dependency>