Thanks for the input Tyler! I've fixed the issue by adding a bit of code to ensure a String is passed to MatFileReader when the unit test is run in maven. The test now successfully compiles - I'll add the code to reviewboard soon for others to scope.
Annie On Tue, Jun 3, 2014 at 2:16 PM, Tyler Palsulich <[email protected]> wrote: > Hi Annie, > > I looks like your problem is with > `MatFileReader(org.apache.tika.io.CloseShieldInputStream)`. > I think the MatFileReader constructor will only take a File or String > filename ( > http://intra.csb.ethz.ch/javadoc/metabolic/com/jmatio/io/MatFileReader.html). > If you switch the constructor call to use the filename, instead of the > InputStream, I wonder if that will fix the issue. > > Hope that helps, > Tyler > > > On Tue, Jun 3, 2014 at 3:07 PM, Annie Burgess <[email protected]> > wrote: > >> Hi dev group, >> >> I've put together a new parser for Matlab (.mat) files. I successfully >> compile and execute the new parser at the command line as: >> >> javac -classpath >> ../../../../tika-core/target/tika-core-1.6-SNAPSHOT.jar:../../../../jmatio-1.2.jar >> edu/usc/sunset/burgess/tika/MatParser.java >> >> java -classpath >> annie-parsers.jar:tika-app/target/tika-app-1.6-SNAPSHOT.jar:jmatio-1.2.jar >> org.apache.tika.cli.TikaCLI --metadata >> /Users/annbryant/POLARCYBER/breidamerkurjokull_radar_profiles_2009.mat >> >> >> However, I've written a unit test for the new parser and have come to a >> roadblock. >> >> The new parser uses a 3rd party jar, JmatIO, file available on Maven >> Central ( >> http://search.maven.org/#artifactdetails%7Cnet.sourceforge.jmatio%7Cjmatio%7C1.0%7Cjar >> ), which I have included as a dependency in the tika-parsers/pom.xml with >> the following: >> >> <dependency> >> <groupId>net.sourceforge.jmatio</groupId> >> <artifactId>jmatio</artifactId> >> <version>1.0</version> >> </dependency> >> >> >> When I run the unit test in maven, maven seems to be able to find the >> appropriate class files from the 3rd party jar, i.e. I don't get any >> "missing package" or "can't find symbol' errors from the 'import' >> commands: import com.jmatio.io.MatFileHeader; However, the test fails >> when the first instance of one of the JmatIO classes is called within the >> parser. >> >> Are there some steps I'm missing when integrating a third party jar in a >> unit test? >> >> I have attached the new parser and the parser test. >> >> Please let me know if any other information would be useful. >> >> Annie >> >> >> ***************************************************************************************** >> >> abryant:tika-parsers abryant$ mvn -Dtest=MatParserTest compile >> >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Building Apache Tika parsers 1.6-SNAPSHOT >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] >> [INFO] --- maven-remote-resources-plugin:1.2.1:process (default) @ >> tika-parsers --- >> [INFO] >> [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ >> tika-parsers --- >> [debug] execute contextualize >> [INFO] Using 'UTF-8' encoding to copy filtered resources. >> [INFO] Copying 5 resources >> [INFO] Copying 3 resources >> [INFO] >> [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ >> tika-parsers --- >> [INFO] Compiling 1 source file to >> /Users/annbryant/TIKA/tika/tika-parsers/target/classes >> [INFO] ------------------------------------------------------------- >> [ERROR] COMPILATION ERROR : >> [INFO] ------------------------------------------------------------- >> [ERROR] >> /Users/annbryant/TIKA/tika/tika-parsers/src/main/java/org/apache/tika/parser/mat/MatParser.java:[69,23] >> cannot find symbol >> symbol : constructor >> MatFileReader(org.apache.tika.io.CloseShieldInputStream) >> location: class com.jmatio.io.MatFileReader >> [INFO] 1 error >> [INFO] ------------------------------------------------------------- >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] BUILD FAILURE >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Total time: 5.213s >> [INFO] Finished at: Tue Jun 03 12:54:15 AKDT 2014 >> [INFO] Final Memory: 16M/81M >> [INFO] >> ------------------------------------------------------------------------ >> [ERROR] Re-run Maven using the -X switch to enable full debug logging. >> [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/MojoFailureException >> >> >> -- >> >> ------------------------------------------------------------------------------------------ >> Ann Bryant Burgess, PhD >> >> Postdoctoral Fellow >> Computer Science Department >> University of Southern California >> Viterbi School of Engineering >> Los Angeles, CA >> >> Alaska Science Center/USGS >> Anchorage, AK >> >> Cell: (585) 738-7549 >> Office: (907) 786-7059 >> Fax: (907) 786-7150 >> E-mail: [email protected] >> Office Address: 4210 University Dr., Anchorage, AK 99508-4626 >> >> ------------------------------------------------------------------------------------------- >> > > -- ------------------------------------------------------------------------------------------ Ann Bryant Burgess, PhD Postdoctoral Fellow Computer Science Department University of Southern California Viterbi School of Engineering Los Angeles, CA Alaska Science Center/USGS Anchorage, AK Cell: (585) 738-7549 Office: (907) 786-7059 Fax: (907) 786-7150 E-mail: [email protected] Office Address: 4210 University Dr., Anchorage, AK 99508-4626 -------------------------------------------------------------------------------------------
