Unable to import all necessary files via Maven

159 views
Skip to first unread message

Austin Ayers

unread,
Jul 9, 2018, 11:26:13 AM7/9/18
to lanterna-discuss
Hi everyone, to preface I have only been programming for about 1.5 years and this is my first time importing a library.
I have learned a bit about Maven, but I still cannot get my project to import all the files from Lanterna.

My pom file look like this:

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.LPS</groupId>
  <artifactId>LPS</artifactId>
  <version>0.0.1-SNAPSHOT</version>  
  <dependencies>
<dependency>
<groupId>com.googlecode.lanterna</groupId>
<artifactId>lanterna</artifactId>
    <version>3.0.1</version>
</dependency>
  </dependencies>
</project>

I have tried Eclipse and IntelliJ to see if it is something with my IDE, but both have the same issue: All the classes import except for com.googlecode.lanterna.graphics.TextGraphics;
Eclipse: 

IntelliJ 



My file explorer shows the jar is present and the other classes seem to work just fine?



I tried a different one of the examples without the class I mentioned above, and got this error:

Error: Unable to initialize main class app

Caused by: java.lang.NoClassDefFoundError: com/googlecode/lanterna/screen/Screen


This leads me to believe that none of my dependencies are properly working even though I have followed multiple tutorials on importing into Maven?


I tried editing the class path and linking my JRE to a local version of the .jar on my system, but that also didn't work.


I've spent more time trying to set up this library than actually coding these last few days, does anyone have an idea what I'm doing wrong?


Martin Berglund

unread,
Jul 17, 2018, 10:51:01 PM7/17/18
to lanterna...@googlegroups.com
Hi Austin,
Can you try to run the "Install" Maven lifecycle, either from command line or from the Maven tab in IntelliJ:
bild.png
Then look in the console output and look for an error message. I suspect something is wrong with the jar since it's able to find some classes but not others.

Regards,
Martin

--
Det här meddelandet skickas till dig eftersom du prenumererar på gruppen "lanterna-discuss" i Google Grupper.
Om du vill sluta prenumerera på den här gruppen och inte längre få någon e-post från den skickar du ett e-postmeddelande till lanterna-discu...@googlegroups.com.
Fler alternativ finns på https://groups.google.com/d/optout.

Pordi Erstaquel

unread,
Jul 18, 2018, 7:29:12 PM7/18/18
to lanterna-discuss
Things to try:
- check the contents of that jar file,
- check the project's build path and make sure it is pointing to the jar you think it should point to
- check the error Eclipse is giving: could be the trivial "cannot find class in path", but maybe it is something else.

This is one of the reasons I don't like middleman (in this case Maven): when things go ok, all is fine, but when the thing doesn't work it just gets in the way for a resolution.
Reply all
Reply to author
Forward
0 new messages