Path: lib/generated/examples/chart_module_dependencies.txt
Last Update: Sat May 30 00:44:04 +0200 2015

Example usage of JavaClass::Dependencies::Graph: Iterate all folders of a root folder. Load each component separately and construct the dependency graph.

Author:Peter Kofler
Copyright:Copyright (c) 2009, Peter Kofler.
License:BSD License


 require 'javaclass/dsl/mixin'
 require 'javaclass/dependencies/graph'
 require 'javaclass/dependencies/classpath_node'
 require 'javaclass/dependencies/yaml_serializer'
 require 'javaclass/dependencies/graphml_serializer'

1) define the location of the plugins

 location = 'C:\Eclipse\workspace'

 plugins =

2) iterate all plugins of a workspace location do |folder|
   path = File.join(location, folder)
   next unless path

   classes = File.join(path, 'bin')
   next unless FileTest.exist?(classes)

3) create a classpath for each plugin

   cp = classpath(classes)
   next if cp.count == 0

4) add a JavaClass::Dependencies::Node for that plugin to the graph

   plugins.add(, cp))

5) resolve all dependencies of all nodes in the graph

 puts "#{plugins.to_a.size} plugins loaded"

6) save the result in various formats, e.g. GraphML or YAML'plugin_dependencies', plugins)'plugin_dependencies', plugins) => :summary).save('plugin_dependencies_summary', plugins)