Mvn compile throwns an error related to ZipAndSendMail | Selenium Forum
Mahanthi Kanakamedala Posted on 28/01/2021

When we run "mvn compile" after setting up email configuration in the project, following error is observed. Unable to run the tests using mvn.

<projectr path>/hybrid/mail/[28,71] method references are not supported in -source 1.7(use -source 8 or higher to enable method references)

**However emails are successfully sent when ZipAndSendMail is run from eclipse

Please let me know, how to resolve this.


Ashish Replied on 30/01/2021

Please use jdk 8 and mention in maven that use source java 8


In maven compiler plugin-


Mahanthi Kanakamedala Replied on 31/01/2021

Thank You, Ashish! for the response. I have updated POM with above mentioned configuration.
mvn clean compile test  is working now. But when I run the command for emailing following issue is observed : mvn exec:java -Djava.version=1.8 -D"exec.mainClass"=" com.hoolva.hybrid.mail.ZipAndSendMail"

[INFO] Scanning for projects...
[INFO] -----------------< com.hoolva.hybrid:Automate_Hoolva >------------------
[INFO] Building Automate_Hoolva 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ Automate_Hoolva ---
java.lang.ClassNotFoundException: com.hoolva.hybrid.mail.ZipAndSendMail
at (
at java.lang.ClassLoader.loadClass (
at java.lang.ClassLoader.loadClass (
at org.codehaus.mojo.exec.ExecJavaMojo$ (
at (
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.895 s
[INFO] Finished at: 2021-01-31T11:42:16+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project Automate_Hoolva: An exception occured while executing the Java class. com.hoolva.hybrid.mail.ZipAndSendMail -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

Ashish Replied on 02/02/2021

java.lang.ClassNotFoundException: com.hoolva.hybrid.mail.ZipAndSendMail


Its not able to find the ZipAndSendMail class at the given path.

Mahanthi Kanakamedala Replied on 10/02/2021

Thank you, the issue is resolved now. There was an extra space in the file path.

Related Posts