Closed BenjaminChilson closed 4 years ago
What's the exact error message? IDE? Could you post your project anywhere? (Or send it to me privately if it needs to stay private)
Here is a link to my project so far on github. It's at a bare minimum now. Just trying to get the client to work on it to get started
That’s a 404; is it a private repo?
It should be public now
mvn compile
worked for me after I added the import. What's the error you're getting? What exactly are you trying to do? Did you forget the import?
import me.sargunvohra.lib.pokeapi.client.*;
I definitely did not include that import. That is surely the last piece to this puzzle. Hopefully one final question. When I simply paste import me.sargunvohra.lib.pokeapi.client.*;
at the end of my list of imports it gives the message package me.sargunvohra.lib.pokeapi.client does not exist
. Is there any other steps I may be missing for it to find this package?
Ah sorry, it’s me.sargunvohra.lib.pokekotlin.client.*
Your Java IDE should be able to find missing imports when you type out the class name
Or if you’re not using an IDE you can just browse the repo to find the right import: https://github.com/PokeAPI/pokekotlin/tree/master/src/main/kotlin/me/sargunvohra/lib/pokekotlin/client
I am using an IDE. However even with import me.sargunvohra.lib.pokekotlin.client.*;
it is giving me.sargunvohra.lib.pokekotlin.client does not exist
Which IDE? How did you import the dependencies configured in your maven? Do other libraries work?
It is the netbeans IDE. I'm unsure of what you mean by how did I import the dependencies configured in my maven, as I am still beginning to understand maven. The only thing I have done with maven is add the dependencies to the pom.xml file and attempt to run the program. The only libraries I have used up to this point are mainly the java or javafx libraries and so this would be my first external library that I am importing.
I'm not familiar with NetBeans, but usually IDEs have a button to "import" Maven projects, which reads the pom.xml file and adds the library jars to the compiler classpath. If a project is already imported, sometimes you need to "sync" the project to pick up edits to the pom.xml file.
Are you able to compile from the command line? Try mvn compile
from your project root. If that works, then we know the problem is finding how to import/sync the project to your IDE.
I see the dependencies jars added folders of my project. I have run mvn compile from terminal and received a BUILD SUCCESS.
looking into how to sync the project to see these edits
I installed NetBeans and tried opening your project; seems like the pom.xml is recognized and imported automatically, at least on initial load: https://streamable.com/l8yx5n
I see in your screenshot that the correct dependencies are present in the tree view on the left, so the pom was synced. Perhaps restart NetBeans? Or try the "Clean and Build" button? What does NetBeans show you inside the pokekotlin jar? It should look something like this:
the contents inside of my jar seem different and I am not sure why that is. I also did a re-install of netbeans to see if that solved anything, It did not.
That's really strange, I'd investigate the cached artifacts in ~/.m2/repository, or perhaps just delete that directory and have maven redownload them. Do the other dependencies appear correct?
THATS IT! Deleting and repopulating that folder fixed that jar file and now recognizes that package and even prompts the import as in your screen recording. Thanks so much for all the help!
When trying to use the classes defined in the example case of the project:
PokeApi pokeApi = new PokeApiClient();
neither
PokeApi
norPokeApiClient
are being recognized as known classes