Is there a method of knowing the depending library in the java library?
If possible, I want to know the method to know by the tool or the command.
My method usually consists of googling the class and method and downloading the appropriate jar. :) Sometimes it takes some research.
Check classycle and JDepend, they both do dependency checks and can be used to automate process using ant.
JBoss TattleTale may help you, it's very easy to use.
"Tattletale is a tool that can help you get an overview of the project you are working on or a product that you depend on."
I'd suggest letting Maven handle your dependencies (NetBeans has good inbuilt support, for example). Once you're using it, it's easy to view the dependency tree.
Related
Getting call hierarchy is easy in IntelliJ. Simply use the built in tool. But is there a way to do it using code? Eclipse internal JDT has two classes called CallHierarchy and MethodWrapper that help to do so: link
If there is no equivalent in IntelliJ, is there another pre-built way I can find all callers of a specific method (and base methods)? (Can we programmatically invoke Find Usages?)
In short, for a specific method, I'd like to get all other methods and classes that use the base method in a Collection<> of some sort.
Thanks in advance for any responses or ideas.
Yes, it's possible. After research and a bunch of asking around, the IntelliJ developers pointed me at the IntelliJ Platform SDK... Didn't know this existed. This link in particular points out how to use Find Usages in the SDK. Hope this helps someone in the future.
I was trying to get started with using (not making contributions to) the geotools lib yesterday,but i ended up trying to figure out what purpose does maven serve when it comes to someone that just wants to build a small/medium app based on geotools;At first i thought that using maven spares the dev on writing all the imports ( that's what i recon dependencies are BTW) but after reading a blog that had a somewhat modified version of the quickstart tutorial i'm not that sure anymore..Could someone make clarify what is maven's use for someone that just wants to build some apps and not make contributions?
Maven has nothing to do with saving you from import declarations in Java source files. It is about handling your whole project and that might include dependencies. But you still have to write imports in Java. If your project is to small for maven to be useful, don't use it. But in larger project a declarative build description, dependency management tool is definitely useful.
I wouldn't attempt to use the GeoTools library without Maven, it is a large and quite complex project with 10s of jars. Your app will probably only need 5-10 of those jars but without Maven it is almost impossible to work out which 5-10 you'll need. For example you will probably want to read in some data, so you'll need gt-data and at least one specific datastore gt-shapefile or gt-postgis. I'm pretty sure one of those will need to use a coordinate system so gt-referencing (and a specific implementation, say gt-epsg-hsql).
Anyway you should probably work through at least the quick start tutorial to see what Maven does for you.
I'd like to try using WebTest, preferably from Clojure, but I can only find its functionality exposed as Ant tasks. There seems to be some sort of Groovy interface, which implies that it's possible to use from any JVM language outside of Ant, but I can't figure it out.
I'm hoping to use WebTest as a "scriptable browser" to load up someone else's page and see if it does various unpleasant things, rather than test my own page with every build, so Ant doesn't really seem like an appropriate solution if I can avoid it.
It is often the case that useful Java functionality is hidden behind Ant tasks. I hit the issue when writing the book (pre-leiningen et al), and wrote lancet to let you call Ant tasks as clojure functions.
Lancet would probably need to be extended to handle arbitrary Ant tasks, but since it is now being maintained (as a dependency of leiningen) you might find other people willing to help out.
I am late into the game.
What about directly using the underlying httpunit java library straight from clojure ?
I intend to develop a system that is entirely based on modules. The system base should have support for finding out about plugins, starting them up and being able to provide ways for those modules to communicate. Ideally, one should be able to put in new modules and yank out unused modules at will, and modules should be able to use each other's funcionality if it is available.
This system should be used as a basis for simulation systems where a lot of stuff happens in different modules, and other modules might want to do something based on that.
The system I intend to develop is going to be in Java. The way I see it, I intend to have a folder with a subfolder for each module that includes a XML that describes the module with information such as name, maybe which events it might raise, stuff like that. I suppose I might need to write a custom ClassLoader to work this stuff out.
The thing is, I don't know if my idea actually holds any water and, of course, I intend on building a working prototype. However, I never worked on a truly modular system before, and I'm not really sure what is the best way to take on this problem.
Where should I start? Are there common problems and pitfalls that are found while developing this kind of system? How do I make the modules talk with each other while maintaining isolation (i.e, you remove a module and another module that was using it stays sane)? Are there any guides, specifications or articles I can read that could give me some ideas on where to start? It would be better if they were based on Java, but this is not a requirement, as what I'm looking for right now are ideas, not code.
Any feedback is appreciated.
You should definitely look at OSGi. It aims at being the component/plugin mechanism for Java. It allows you to modularize your code (in so-called bundles) and update bundles at runtime. You can also completely hide implementation packages from unwanted access by other bundles, eg. only provide the API.
Eclipse was the first major open-source project to implement and use OSGi, but they didn't fully leverage it (no plugin installations/updates without restarts). If you start from scratch though, it will give you a very good framework for a plugin system.
Apache Felix is a complete open-source implementation (and there are others, such as Eclipse Equinox).
Without getting into great detail, you should be looking at Spring and a familiarization with OSGI or the Eclipse RCP frameworks will also give you some fundamental concepts you will need to keep in mind.
Another option is the ServiceLoader added in Java 1.6.
They are many way to do it but something simple can be by using Reflection. You write in your XML file name of file (that would be a class in reallity). You can than check what type is it and create it back with reflection. The class could have a common Interface that will let you find if the external file/class is really one of your module. Here is some information about Reflexion.
You can also use a precoded framework like this SourceForge onelink text that will give you a first good step to create module/plugin.
I am currently working on a mantenance project that is written in Java. We are currently working to clean up the code some and try to provide a little more organization to the project overall.
The list of libraries that are included in the build have grown long, and honestly no one remains that knows/remembers what each library is used for or why? So I am looking for a tool that would be able to essentially find where the library is used in the code. Essentially like a find usage function in an IDE has for functions.
Does such a tool exist? I am curently using Netbeans and as mentioned our code is in java.
I know I could remove each library and compile the project for each library to find the usages, but it just seems there should be a better way. Any ideas?
Since you're using NetBeans, I suggest the SQE plugin, which includes Dependency Finder. (And if you weren't already using FindBugs, this is a good time to start.)
Try using jarjar. It has a command line interface that will analyze your dependency tree.
I haven't used it for a few years but I remember that JDepend was useful when I was in a similar situation.
You could let Eclipse remove unnecessary imports for you. Then simply search through the code for imports relating to a specific library's package name.