Maven spring ide plugin

Spring IDE is an eclipse plugin that allows you to view graphs of your spring beans and their dependencies.

The maven-spring-ide-plugin searches your source files or web.xml file for inclusive and exclusive bean locations as you would present them to a ModuleApplicationContext. To do this, it parses a java or XML source file that must have special comments as described below. Based on the found locations it creates the .springBeans file needed by SpringIDE and forces Spring Nature for the project in eclipse (by modification of the .project file).

After execution, the project has an entry in the Spring Explorer inside eclipse containing all defined beans.

The plugin is run by executing "mvn spring-ide:spring-ide" from its directory.

<plugin>
        <groupId>ch.elca.el4j.maven.plugins</groupId>
        <artifactId>maven-spring-ide-plugin</artifactId>
</plugin>

The file must follow these conventions:

  • The inclusive locations are marked with a comment "// $$ BEANS INCLUDE $$" on a line of its own. For XML, use <!-- $$ BEANS INCLUDE $$ -->
  • The following lines may each contain one string at most enclosed in double quotes.
  • The included lines end as soon as a "}" (java) or a closing tag (xml) is read.
  • Commented lines (using // in front or /*...*/ around one or multiple lines) are not read.

If exclusive lines are present, they are preceded with "// $$ BEANS EXCLUDE $$" or <!-- $$ BEANS EXCLUDE $$ -->, the rest is the same for the inclusion tags.

Examples:

// $$ BEANS INCLUDE $$ 
String[] applicationContextPaths = {
    "classpath*:mandatory/*.xml",
    "classpath*:scenarios/db/raw/*.xml",
    "classpath*:scenarios/dataaccess/hibernate/*.xml",
    "classpath*:scenarios/dataaccess/hibernate/refdb/*.xml",
    "classpath*:optional/interception/transactionJava5Annotations.xml",
    "classpath*:Interceptors.xml",
    "classpath:scenarios/swing/demo/applicationGeneral.xml"
}; 
// $$ BEANS EXCLUDE $$
String[] excluded = {
  "classpath*:exclude-*.xml"
};
<param-value>
<!-- $$ BEANS INCLUDE $$ -->
    classpath*:mandatory/*.xml,
    classpath*:mandatory/refdb/*.xml,
    classpath*:scenarios/db/raw/*.xml
</param-value>

For detailed usage see the plugin info page.