Terge3141 / WhatsIllustrator

Creates PDF documents from WhatsApp chats
GNU General Public License v3.0
3 stars 0 forks source link

Error when trying to build #25

Closed hirasso closed 1 year ago

hirasso commented 1 year ago

Hi there! I just wanted to give this (promising!) package a go. Installed Java and Maven as described here.

When running mvn package, it fails. Here's the output with the -e flag:

❯ mvn package -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.120 s
[INFO] Finished at: 2023-04-03T10:39:52+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/XXX/Documents/WhatsIllustrator). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/Users/XXX/Documents/WhatsIllustrator). Please verify you invoked Maven from the correct directory.
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:80)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[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/MissingProjectException

Version Information

$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
$ mvn -version
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: /Users/XXX/Documents/apache-maven-3.9.1
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

Any idea?

Terge3141 commented 1 year ago

Hi,did you change to the subdirectory whatsillustrator? It appears that you are still in the main directory.So cd whatsillustratorshould help.Von Samsung-Tablet gesendet -------- Ursprüngliche Nachricht --------Von: Rasso Hilber @.> Datum: 03.04.23 10:44 (GMT+01:00) An: Terge3141/WhatsIllustrator @.> Cc: Subscribed @.***> Betreff: [Terge3141/WhatsIllustrator] Error when trying to build (Issue #25) Hi there! I just wanted to give this (promising!) package a go. Installed Java and Maven as described here. When running mvn package, it fails. Here's the output with the -e flag: ❯ mvn package -e [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.120 s [INFO] Finished at: 2023-04-03T10:39:52+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/XXX/Documents/WhatsIllustrator). Please verify you invoked Maven from the correct directory. -> [Help 1] org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/Users/XXX/Documents/WhatsIllustrator). Please verify you invoked Maven from the correct directory. at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:80) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272) at org.apache.maven.cli.MavenCli.main (MavenCli.java:195) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) [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/MissingProjectException Version Information $ java -version openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment 18.9 (build 11.0.2+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

$ mvn -version Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8) Maven home: /Users/XXX/Documents/apache-maven-3.9.1 Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

Any idea?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/Terge3141/WhatsIllustrator/issues/25", "url": "https://github.com/Terge3141/WhatsIllustrator/issues/25", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

hirasso commented 1 year ago

Aaaah! Missed that. So in the readme it should actually say this after the git clone:

cd WhatsIllustrator/whatsillustrator
mvn package

Got it to build 👍. But the information in the readme is so sparse that I haven't been able to get it to work. I'm trying to create a PDF from a WhatsApp chat. Created a folder whatsapp in the root of WhatsIllustrator with a config.xml copied from your sampleconfig.xml:

<configuration>
    <global>
        <outputdir>./whatsapp-output</outputdir>
        <debugdir>debugdirectory</debugdir>
    </global>
    <!-- comment one of the parsers -->
    <parser>
        <name>messageparser.WhatsappParser</name>
        <parserconfiguration>
            <messagedir>./chat/</messagedir>
            <imagepooldir>./chat/</imagepooldir>
        </parserconfiguration>
    </parser>
    <writers>
        <writer>
            <name>texcreator.TexWriterPlugin</name>
            <writerconfiguration></writerconfiguration>
        </writer>
        <writer>
            <name>odfcreator.OdfWriterPlugin</name>
            <writerconfiguration></writerconfiguration>
        </writer>
        <writer>
            <name>fopcreator.FOPWriterPlugin</name>
            <writerconfiguration></writerconfiguration>
        </writer>
    </writers>
</configuration>

When I try to run the generator, I get errors:

$ pwd
/Users/xxx/Documents/WhatsIllustrator/whatsillustrator
$ java -cp thebook/target/thebook-0.0.1-SNAPSHOT-jar-with-dependencies.jar\
  thebook.Program -c ../whatsapp/config.xml
Unrecognized option: -c
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

The documentation is not detailed enough for complete Java greenhorns like me :)

A complete sample folder for each of the clients (WhatsApp, Telegram, Signal) would be very helpful I guess...

hirasso commented 1 year ago

Should the paths in the config.xml be relative to the config file or relative to the current pwd?

Terge3141 commented 1 year ago

First of all, thanks for the feedback and sorry about the late reply. I'll update the README file. It appears as if the java vm does not start correctly. Could you please try the following: java -cp thebook/target/thebook-0.0.1-SNAPSHOT-jar-with-dependencies.jar thebook.Program -c ../whatsapp/config.xml If that doesnt work try: java -cp thebook/target/thebook-0.0.1-SNAPSHOT-jar-with-dependencies.jar "thebook.Program -c ../whatsapp/config.xml"

Please let know if it works or not.

hirasso commented 1 year ago

Thanks for your answer! The first command works for me (already found that backslash in the example in the README pretty suspicious):

java -cp thebook/target/thebook-0.0.1-SNAPSHOT-jar-with-dependencies.jar thebook.Program -c ../whatsapp/config.xml

I also found out that the folders in my config.xml should be relative to the current working directory right now. They are found/not found depending on from where I start the program. Changing the paths from relative to absolute and leaving the /chat folder out of it, worked for me:

<parser>
    <name>messageparser.WhatsappParser</name>
    <parserconfiguration>
        <messagedir>/Users/xxx/Documents/WhatsIllustrator/whatsapp</messagedir>
        <imagepooldir>/Users/xxx/Documents/WhatsIllustrator/whatsapp</imagepooldir>
    </parserconfiguration>
</parser>

The actual chat folder lies under /Users/xxx/Documents/WhatsIllustrator/whatsapp/chat. Maybe your script could more gracefully handle these cases?

  1. relative paths in config.xml
  2. omitting the /chat endpoint if it's already in the config

Now for the first time WhatsIllustrator actually generated a PDF. The messages are there, but the image isn't:

image

The relevant error message is somewhere around these lines:

Apr 07, 2023 4:54:08 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not available. URI: /Users/xxx/Documents/WhatsIllustrator/whatsapp/chat/IMG-20151021-WA0000.jpg. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for /Users/xxx/Documents/WhatsIllustrator/whatsapp/chat/IMG-20151021-WA0000.jpg (No context info available)
org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for /Users/xxx/Documents/WhatsIllustrator/whatsapp/chat/IMG-20151021-WA0000.jpg
    at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:181)
    at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:127)
    at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)
    at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)
    at org.apache.fop.fo.FObj.processNode(FObj.java:131)
    at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:321)
    at org.apache.fop.fo.FOTreeBuilder$2.run(FOTreeBuilder.java:185)
    at org.apache.fop.fo.FOTreeBuilder$2.run(FOTreeBuilder.java:182)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:181)
    at java.xml/com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:206)
    at java.xml/com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:250)
    at java.xml/com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:245)
    at java.xml/com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:557)
    at jdk.translet/die.verwandlung.WhatsApp_20Chat_20with_20Biff.template$dot$4()
    at jdk.translet/die.verwandlung.WhatsApp_20Chat_20with_20Biff.applyTemplates()
    at jdk.translet/die.verwandlung.WhatsApp_20Chat_20with_20Biff.template$dot$1()
    at jdk.translet/die.verwandlung.WhatsApp_20Chat_20with_20Biff.applyTemplates()
    at jdk.translet/die.verwandlung.WhatsApp_20Chat_20with_20Biff.applyTemplates()
    at jdk.translet/die.verwandlung.WhatsApp_20Chat_20with_20Biff.transform()
    at java.xml/com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:624)
    at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:776)
    at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:370)
    at fopcreator.FOPWriterPlugin.toPDF(FOPWriterPlugin.java:231)
    at fopcreator.FOPWriterPlugin.postAppend(FOPWriterPlugin.java:121)
    at creator.BookCreator.write(BookCreator.java:78)
    at thebook.Program.main(Program.java:93)

Apr 07, 2023 4:54:08 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
Apr 07, 2023 4:54:08 PM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".
Apr 07, 2023 4:54:09 PM org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI: /Users/xxx/Documents/WhatsIllustrator/whatsapp/chat/IMG-20151021-WA0000.jpg. (No context info available)
Apr 07, 2023 4:54:09 PM org.apache.fop.events.LoggingEventListener processEvent
INFO: Rendered page #1.
16:54:09.099 [main] INFO  thebook.Program - Done 2.019