I'm noticing that most Java web dev tutorials I come by are designed for people using an IDE and/or Maven instead of the Ant/text-editor combo that I use.
I've learned to determine where the POM.xml
excerpts download the deps by using http://mvnrepository.com/ , but I'm still having a hard time determining the proper import statements when the tutorial omits them.
Sometimes, I've found that even if I find the docs, I may find that there's no obvious way to determine a symbol's package of origin . (try to find out which package @Produces belongs to) .
So, here's the scenario: you try to compile and you find out there's a missing symbol and you have no idea where that symbol is supposed to come from. What do you do? Other than chasing geese on Google all day, how do I determine the import statement when it's missing from the tutorial?
Thanks in advance.
I've figured out that I can construct an import statement by using the file hierarchy in the unzipped jar file ( for instance, jersey-multipart-1.19/com/sun/jersey/multipart
becomes import com.sun.jersey.multipart.*
). But that still doesn't necessarily tell me how to go the other direction, eg to find out where @Produces
is defined.
During development one can use the search index that comes with Maven Central to find the modules containing missing classes:
Better yet, deploy a local Maven repository manager like Nexus , Artifactory or Archiva . These would mirror Maven central's index and also index any local jars you might publish.
Finally I highly recommend integrating one of the dependency management plugins for ANT. Life is too short to be manually resolving nested java dependencies :-)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.