为什么我不能编译iText源代码?

时间:2014-09-17 03:26:03

标签: itext

运行mvn install -P all -e以编译和安装iText后出错。 我之前也做过mvn clean。错误说:

testFlatteningGenerateAppearances2(com.itextpdf.text.pdf.FlatteningTest):
    Path to GhostScript is not specified. Please use -DgsExec

我是否需要安装Ghostscript? 我以为maven会照顾所有的依赖。

C:\code4-itext\itext-code-6558-trunk\itext>mvn install -P all -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building iText, a Free Java-PDF library 5.5.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- buildnumber-maven-plugin:1.1:create (default) @ itextpdf ---
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: C:\code4-itext\itext-code-6558-trunk\itext
[INFO] Storing buildNumber: null at timestamp: 1410923963268
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: C:\code4-itext\itext-code-6558-trunk\itext
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ itextpdf ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 24 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ itextpdf ---
[INFO] Compiling 601 source files to C:\code4-itext\itext-code-6558-trunk\itext\target\classes
[INFO]
[INFO] --- maven-bundle-plugin:2.3.4:manifest (bundle-manifest) @ itextpdf ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ itextpdf ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 189 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ itextpdf ---
[INFO] Compiling 63 source files to C:\code4-itext\itext-code-6558-trunk\itext\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.9:test (default-test) @ itextpdf ---
[INFO] Surefire report directory: C:\code4-itext\itext-code-6558-trunk\itext\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.itextpdf.text.pdf.CMapAwareDocumentFontTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.25 sec
Running com.itextpdf.text.pdf.parser.LocationTextExtractionStrategyTest
Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.094 sec
Running com.itextpdf.text.pdf.parser.VectorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.RandomAccessFileOrArrayTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.ChunkTest
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.281 sec
Running com.itextpdf.text.pdf.fonts.cmaps.CMapTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.cs.LabColorSpaceTest
[itext] INFO  Comparing by content..........OK
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec
Running com.itextpdf.text.pdf.TextFieldTest
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec
Running com.itextpdf.text.io.FileChannelRandomAccessSourceTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.062 sec
Running com.itextpdf.text.io.GroupedRandomAccessSourceTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running com.itextpdf.text.pdf.TaggedPdfCopyTest
Tests run: 30, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 24.726 sec
Running com.itextpdf.text.pdf.parser.MatrixTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.error_messages.ErrorMessageTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.MappedRandomAccessFileTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.html.parser.HtmlWorkerWhitSpaceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running com.itextpdf.text.pdf.parser.GlyphTextRenderListenerTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running com.itextpdf.text.pdf.AcroFieldsTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Running com.itextpdf.text.io.ArrayRandomAccessSourceTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.TestPdfCopyAndStamp
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running com.itextpdf.text.pdf.PRTokeniserTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.ToUnicodeNonBreakableSpacesTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.io.PagedChannelRandomAccessSourceTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running com.itextpdf.text.io.GetBufferedRandomAccessSourceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.fonts.cmaps.CMapParserExTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.PdfReaderSelectPagesTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.cs.DeviceNColorSpaceTest
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.table.RowspanTest
true
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.078 sec
Running com.itextpdf.text.RemoteGifImageTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.983 sec
Running com.itextpdf.text.xml.simpleparser.SimpleXMLParserTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.signature.XmlDSigRsaTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.546 sec
Running com.itextpdf.text.html.WebColorTest
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running com.itextpdf.text.pdf.parser.TextRenderInfoTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running com.itextpdf.text.error_messages.MessageLocalizationTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running com.itextpdf.text.pdf.fonts.SymbolTest
[itext] INFO  Comparing by content..........OK
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.error_messages.ErrorMessageExistenceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.375 sec
Running com.itextpdf.text.pdf.DocumentFontTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running com.itextpdf.text.html.parser.HtmlWorkerParagraphTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.html.parser.HtmlWorkerLinkTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.UnbalancedOperatorsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.parser.PdfImageObjectTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.249 sec
Running com.itextpdf.text.pdf.FlatteningTest
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
Tests run: 9, Failures: 7, Errors: 0, Skipped: 0, Time elapsed: 0.063 sec <<< FAILURE!
Running com.itextpdf.text.signature.XadesTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.234 sec
Running com.itextpdf.text.signature.XmlDSigCertTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.093 sec
Running com.itextpdf.text.pdf.parser.MultiFilteredRenderListenerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.468 sec
Running com.itextpdf.text.pdf.parser.TextMarginFinderTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.PdfReaderTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.016 sec
Running com.itextpdf.text.pdf.MultithreadedTtfTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.234 sec
Running com.itextpdf.text.pdf.PdfCopyTest
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
[itext] INFO  Comparing by content..........OK
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.406 sec
Running com.itextpdf.text.pdf.parser.SimpleTextExtractionStrategyTest
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.signature.XmlDSigKSTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.109 sec
Running com.itextpdf.text.pdf.BookmarksTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.parser.PdfTextExtractorEncodingsTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.187 sec
Running com.itextpdf.text.io.WindowRandomAccessSourceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.parser.FilteredTextRenderListenerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running com.itextpdf.testutils.ClearOutTempFilesDuringTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.MetaDataTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.html.parser.HtmlXFAWorkerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.itextpdf.text.pdf.TaggedPdfTest
Tests run: 25, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.342 sec
Running com.itextpdf.text.pdf.parser.PdfContentStreamProcessorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
Running com.itextpdf.text.xml.xmp.XmpWriterTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec

Results :

Failed tests:   testFlatteningGenerateAppearances2(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec=<p
ath_to_ghostscript> (e.g. -DgsExec="C:/Program Files/gs/gs9.14/bin/gswin32c.exe")
  testFlatteningGenerateAppearances1(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec=<path_to_ghostsc
ript> (e.g. -DgsExec="C:/Program Files/gs/gs9.14/bin/gswin32c.exe")
  testFlattening(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec=<path_to_ghostscript> (e.g. -DgsExec
="C:/Program Files/gs/gs9.14/bin/gswin32c.exe")
  testFlatteningGenerateAppearances4(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec=<path_to_ghostsc
ript> (e.g. -DgsExec="C:/Program Files/gs/gs9.14/bin/gswin32c.exe")
  testFlatteningGenerateAppearances5(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec=<path_to_ghostsc
ript> (e.g. -DgsExec="C:/Program Files/gs/gs9.14/bin/gswin32c.exe")
  testFlatteningGenerateAppearances6(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec=<path_to_ghostsc
ript> (e.g. -DgsExec="C:/Program Files/gs/gs9.14/bin/gswin32c.exe")
  testFlatteningGenerateAppearances3(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec=<path_to_ghostsc
ript> (e.g. -DgsExec="C:/Program Files/gs/gs9.14/bin/gswin32c.exe")

Tests run: 246, Failures: 7, Errors: 0, Skipped: 4

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.209 s
[INFO] Finished at: 2014-09-16T20:20:07-08:00
[INFO] Final Memory: 29M/552M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on project itextpdf: There are test failures.
[ERROR]
[ERROR] Please refer to C:\code4-itext\itext-code-6558-trunk\itext\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test)
on project itextpdf: There are test failures.

Please refer to C:\code4-itext\itext-code-6558-trunk\itext\target\surefire-reports for the individual test results.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to C:\code4-itext\itext-code-6558-trunk\itext\target\surefire-reports for the individual test results.
        at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:87)
        at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary(SurefirePlugin.java:631)
        at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:605)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:136)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:97)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
[ERROR]
[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
C:\code4-itext\itext-code-6558-trunk\itext>

1 个答案:

答案 0 :(得分:2)

在命令行中添加参数maven.test.skip=trueskipTests=true。测试创建了大量PDF文件(新文档),需要与参考PDF文件(与测试一起存储的现有文档)进行比较。 Ghostscript用于创建这些PDF文件的图像。这些图像以像素为基础进行比较,以检查新文件是否具有相同的参考文件外观。

如果要使用测试构建iText ,则需要Ghostscript。 如果你想仅仅为了获得一个jar来构建iText,你可以跳过测试而不需要Ghostscript。