Groovy plugin - how to add classes dynamically

Hi, with the Groovy plugin you can change the code in the supplied classes on the fly, but is it possible to add new classes just by placing them in the same folder? Is there a straightforward way to do that?

1 comment

Simone,

The plugin relies on Spring framework to load the Groovy files and watch for their changes, so it's not easy to add new files and just use them from others.
If you are looking into adding more classes, try using the approach from BuildResourcesLock.groovy whch has several classes defined.

If you want to add new class to be instantiated by Spring framework (like implement a new TeamCity extension point), you can update src\META-INF\build-server-plugin-groovyPlug.xml file adding a new file just like already present there:
add the script name into "scriptPreparer" bean and add the bean definition to reference a class from the script.

0

Please sign in to leave a comment.