Javabrowser is a project mainly written in JAVASCRIPT and CLOJURE, it's free.
Browse and search for classes in jars on a java project's classpath
This is a web project that I wrote primarily to learn Clojure (and Clojurescript!). It's very alpha and so a little rough around the edges, but as I have time and/if there's any interest, I'd be happy to add more functionality.
Itch: You are working with Maven and would like a helpful view of all the jars and classes on your project's classpath.
Scratch: When this webapp is started from within a directory that is a maven project, it will use the pom to find jar dependencies and then display a nice web page that allows you to browse and search the classes that are being included the classpath by maven.
Watch a 3 minute video of how to use inside you're maven project:
http://www.screencast.com/t/CSXMSpCDR2i
Contains clojure serve side code
Server side unit tests
Stuff used by server unit tests
Contains clojurescript client side stuff
Contains the sass stylesheets. These are automatically converted to css files inside resources/public/stylesheets
Static resources that are all bundled up and included in the
war. Stylesheets are generated from stylesheets
sass
files. Javascript is generated from src/main/cljs
. Html is generated
by exporting serve haml views.
lein ring server
lein test
In Emacs:
lein swank
Then, in emacs:
slime-connect
Outside of Emacs (but why?!!!):
lein repl
API
(get-jars-on-classpath)
REST
/rest/jars?search=.*
API
(search-jars <name>)
REST
/rest/jars?search=<name>
API
(get-classes-in-zip <path-to-jar>)
REST (wip, need to finish)
/rest/jars?jar=<path-to-jar>
API
(search-classes <class-name>)
REST
/rest/search?search=<class-name>
API
(get-classes-in-zips [jar-file1 jar-file2] ... etc)
REST
/rest/classes?jars="path-to-jar1,path-to-jar2,etc.."
or filter by class name:
/rest/classes?jars="path-to-jar1,path-to-jar2,etc.."&search="Appender"
or filter AND page the results
/rest/classes?jars="path-to-jar1,path-to-jar2,etc.."&search="Appender"&offset=20&max=20
I'm using a few technologies here including Clojurescript, and a ruby gem called "Serve" (that uses haml, and sass).
This is also a Serve project just for convenience of having compass,
sass and haml available. Run serve
at the command line and then
browse to port 4000.
Use serve export . resources/public
, then rename haml files to
html.
Start a clojure repl then do the following to compile cljs to javascript.
(use 'cljs.closure)
(def opts {:output-to "resources/public/javascripts/javabrowser.js" :output-dir "resources/public/javascripts/out"})
(build "src/main/cljs" opts)
The haml files can then use the the js. You can also play around with cljs files inside a cljs browser repl (use browser-repl shell script, or, in emacs, call inferior-lisp with it set to use browser-repl).
This compiles clojurescript into javascript code and copies resulting javascript a well as required css and images from closure project into the serve-project.
At this point, you can use the serve
command to play around with
stylesheets and html layouts
This exports stuff out of serve and puts it into resources/public/ so that it can be used by the java webapp.
At this point you can run the java webapp using lein ring server
Change the version in project.clj and maven-project/pom.xml.
lein ring uberwar
Copy the uberwar to src/main/resources/javabrowser.war
, then cd into
maven-plugin and do a mvn install
At this point, you can add it as a maven depencency to local projects like this:
<build>
<plugins>
...
<plugin>
<groupId>com.upgradingdave</groupId>
<artifactId>javabrowser-maven-plugin</artifactId>
<version>x.x.x</version>
</plugin>
...
</plugins>
</build>
Then use mvn javabrowser:start
Ideas for future versions
Make all class and interface names in class details click thru links
Add ability to drill down into source code using maven capabilities
Add ability to toggle between runtime, test and provided scopes
Maybe make it a hosted webapp where (in addition to local maven plugin)? People could search for jars similar to findjars website and then have ability to search and inspect classes.
Figured out how to use requiresDependencyResolution to include project's depenendencys inside the custom mojo.
Added more features for parsing maven pom.xml such as ability to replace property tokens
Converted jquery to clojurescript
Changed UI to use combo box to select jars, then changed back to use list. Learned a lot about google closure widgets ;-)
Fixed relative file path so it works in prod jar and in lein ring server (sort of)
Copyright (C) 2011 Dave Paroulek (upgradingdave.com)
Distributed under the Eclipse Public License, the same as Clojure.