Thanks again,
I am beginning to suspect this is actually a bug with the Eclipse-Groovy
plugin. After restarting my machine I am able to get the program to
build and run from the command line using Gradle. The second I open
Eclipse and try to run the Driver in Eclipse as a "Groovy Script", it
gives me that error, annd my Gradle commands line stops working (really
strange).
I will figure out a way to reproduce and take it up with the appropriate
OSS community. I'd say the Apache POI team can ignore this and if
anyone else complains with the same issue, start by asking them if
they're using Eclipse-Groovy at all. If I do get to the bottom of this
I'll try to come back here and give everyone an update. Thanks again
for your time!
On 3/3/2015 5:23 PM, Dominik Stadler wrote:
BTW, the following works fine for me:
apply plugin: 'groovy'
apply plugin: 'application'
version = '1.0'
mainClassName='Test'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.0.0'
compile (
'org.apache.camel:camel-core:2.14.1',
'org.apache.camel:camel-mail:2.14.1',
'org.apache.poi:poi:3.11',
'org.apache.poi:poi-ooxml:3.11',
'org.apache.commons:commons-lang3:3.3.2'
)
}
task uberjar(type: Jar,dependsOn:[':compileJava',':compileGroovy']) {
from files(sourceSets.main.output.classesDir)
from configurations.runtime.asFileTree.files.collect { zipTree(it) }
manifest {
attributes 'Main-Class': mainClassName
}
}
and
import org.apache.commons.lang3.exception.*
import org.apache.poi.xssf.usermodel.*
class Test{
public static void main(String[] args){
try {
println "About to read a file into a handler."
File file = new File("/tmp/56886_pretty.xlsx")
println "File ${file} read into a handler."
XSSFWorkbook spreadsheet = new XSSFWorkbook(file)
println "Spreadsheet initialized successfully."
} catch(Throwable t) {
println ExceptionUtils.getStackTrace(t)
}
}
}
Executed with
g uberjar && java -jar build/libs/*.jar
Dominik.
On Tue, Mar 3, 2015 at 8:32 PM, Zac Harvey <[email protected]> wrote:
Thanks Dominik,
That was a copy n' paste error on my part. I *am* using 3.11 for all deps
(earlier I had tried 3.8 and forgot to update my Gradle snippet when writing
my original email).
I tried Nick's suggestion and recreated the Driver as a Java source and, to
my great surprise, the problem didn't show up. I am now working with the
Groovy community to pinpoint and will update this mailing list with what I
find in the next coming days.
Best,
Zac
On 3/3/2015 2:28 PM, Dominik Stadler wrote:
Hi,
Your dependencies contain "poi-3.8", the constructor with File did not
exist in that version yet, see
http://svn.apache.org/viewvc/poi/tags/REL_3_8_FINAL/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?revision=1301934&view=markup
Not sure how you got the 3.11 in the output of dependencies, I see 3.8
there as well on "gradle dependencies"! So try to use 3.11 in the
gradle-file and it should work.
Thanks... Dominik.
On Tue, Mar 3, 2015 at 4:49 PM, Nick Burch <[email protected]> wrote:
On Tue, 3 Mar 2015, Zac Harvey wrote:
When that runs, you'll get:
About to read a file into a handler.
File C:\Users\myuser\sample.xlsx read into a handler.
groovy.lang.GroovyRuntimeException: Could not find matching constructor
for: org.apache.poi.xssf.usermodel.XSSFWorkbook(java.io.File)
at
groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1723)
I think this must be a groovy bug - the constructor is really there!
https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFWorkbook.html#XSSFWorkbook%28java.io.File%29
I'd suggest you try to produce the smallest possible groovy project that
shows the problem, then use that as the basis of a bug report to groovy.
Since it works fine with Java, there's not much more we can help you with
here, sorry
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]