Consegui compilar o relatório e gerar o arquivo "gasto_por_mes.jasper" e fazer o mesmo com o subreport1.
JasperFillManager.fillReport("gasto_por_mes.jasper", parametros, conexao);
Gera a Exceção:
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:822)
at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:380)
at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:404)
at net.sf.jasperreports.engine.fill.JRFillSubreport.createEvaluator(JRFillSubreport.java:513)
at net.sf.jasperreports.engine.fill.JRFillSubreport.loadReportEvaluator(JRFillSubreport.java:496)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:463)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:341)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:381)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:500)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:311)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:247)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582)
at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:90)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:286)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:759)
at br.com.caelum.financas.relatorio.TesteGeraRelatorio.main(TesteGeraRelatorio.java:29)
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.control.CompilationFailedException
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)
... 22 more
Alguém mais passou por esse erro e consegui resolver?
Consegui resolver..
Mesmo tendo mudado no relatório a linguagem para java ele ainda tava precisando do groovy. Então coloque a dependencia do groovy no poom.xml e deu tudo certo
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.7</version>
</dependency>