Rundeck development environment

936 views
Skip to first unread message

Greg Schueler

unread,
Oct 18, 2012, 1:35:03 PM10/18/12
to rundeck...@googlegroups.com
Hi all,

I recently received a question regarding how to set up an IDEA such as Eclipse for developing Rundeck in debug or development mode.  Here are notes on how I have my IDE (IntelliJ IDEA) set up: https://github.com/dtolabs/rundeck/wiki/IDE-Development-Environment

-- 
Greg

John Burbridge

unread,
Oct 18, 2012, 6:56:27 PM10/18/12
to rundeck...@googlegroups.com
Nice! Thanks Greg, that was much needed! 

Incidentally, I was also working on a "Developer IDE Setup" doc based on the build changes we discussed a while ago, except I'm using Eclipse (STS). 

Speaking of which, I have a new (work-in-progress) branch with a Gradle based build replacing a lot of the Make functions. The main goal was to focus on making life easier for developers trying to get Rundeck running from Eclipse (STS).


The changes so far:
  • Created a multi-project build with Gradle (there is one parent Gradle project that manages dependencies between projects)
  • Added dependency management (each project now installs their artifact into ~/.m2)
  • Changed the versioning scheme from -dev to -SNAPSHOT to follow the maven standard versioning convention
  • The app.version variable now gets set in gradle.properties and is propagated to all subprojects, including the grails webapp
  • Upgraded the gradle wrapper from 1.0 to 1.2
  • Created a webapp wrapper project so that gradle calls grails dependencies
  • Added maven-publisher plugin to grails so that artifacts are published to ~/.m2 repo
  • Refined .gitignore -- added more filters to exclude build generated files from index 
What has not yet been done:
  • Dynamically populate rundeckapp/pom.xml with the correct version from gradle.properties
  • Creating a self-executable war (currently looking into it...)
  • Have not verified that maven build still works
  • Have not tested setting up with IntelliJ
  • Have not handled packaging (RPM and DEB packages)
  • Have not handled docs generation

How to Setup your IDE with the gradle based build

Checkout the "newbuild" branch.

$ cd rundeck
$ git checkout newbuild
Branch newbuild set up to track remote branch newbuild from origin.
Switched to a new branch 'newbuild'
$ ./gradlew clean build

This should take a few minutes the first time around as it downloads and installs all requirements for the build.

Once the build finishes, import the projects it into STS using the Gradle tooling:

1. Make sure your Gradle installation points to Gradle 1.2




2. Make sure you have Grails 1.3.7 configured



3. Import using [ File --> Import --> Gradle Project ] 

   Select the root folder and hit Build Model, which will take a couple of minutes the first time it runs, then select all projects and hit Finish 



After importing all of the projects your workspace should look like this:


To run Rundeck, refer to Greg's excellent docs below. :)

I would love some feedback if folks think this is useful and moving in the right direction. I'd be glad to continue tackling the last items on the to-do list.

Cheers,
JB

Adolfo Rodriguez

unread,
Apr 3, 2013, 6:37:43 PM4/3/13
to rundeck...@googlegroups.com
For version 1.5, I tried to setup an Eclipse project before reading this thread and run rundeck within Eclipse. I just configured the project in Eclipse as a Java project, added some jars and did a hack on method thisJarFile because it resolves to Eclipse workspace and throw exception after. Code is prepared to load data from the jar.
    private static File thisJarFile() {
    return new File("C:/rundeck/rundeck-launcher-1.5.jar");
    }

With this change, I launched ExpandRunServer with no options, and it works. I am able to login, debug in Eclipse and do almost everything.

BUT it fails with plugins. As plugins are loaded by force with custom classloaders from the jar, rather than from Eclipse workspace, I think is not able to resolve annotations (mixes classes in jar and in Eclipse workspace). Exceptions are:

com.dtolabs.rundeck.core.plugins.PluginException: No Plugin annotation was found for the class: com.dtolabs.rundeck.plugin.localexec.LocalExecNodeStepPlugin
at com.dtolabs.rundeck.core.plugins.JarPluginProviderLoader.getPluginMetadata(JarPluginProviderLoader.java:213)
at com.dtolabs.rundeck.core.plugins.JarPluginProviderLoader.getProviderDeclaration(JarPluginProviderLoader.java:126)
at com.dtolabs.rundeck.core.plugins.JarPluginProviderLoader.listProviders(JarPluginProviderLoader.java:375)
at com.dtolabs.rundeck.core.plugins.DirPluginScanner.listProviders(DirPluginScanner.java:223)
[...]
com.dtolabs.rundeck.core.plugins.PluginException: No Plugin annotation was found for the class: com.dtolabs.rundeck.plugin.script.ScriptFileCopier
at com.dtolabs.rundeck.core.plugins.JarPluginProviderLoader.getPluginMetadata(JarPluginProviderLoader.java:213)
[...]
com.dtolabs.rundeck.core.plugins.PluginException: No Plugin annotation was found for the class: com.dtolabs.rundeck.plugin.script.ScriptNodeExecutor
at com.dtolabs.rundeck.core.plugins.JarPluginProviderLoader.getPluginMetadata(JarPluginProviderLoader.java:213)
[...]
com.dtolabs.rundeck.core.plugins.PluginException: No Plugin annotation was found for the class: com.dtolabs.rundeck.plugin.stub.StubFileCopier
at com.dtolabs.rundeck.core.plugins.JarPluginProviderLoader.getPluginMetadata(JarPluginProviderLoader.java:213)
[...]
com.dtolabs.rundeck.core.plugins.PluginException: No Plugin annotation was found for the class: com.dtolabs.rundeck.plugin.stub.StubNodeExecutor
at com.dtolabs.rundeck.core.plugins.JarPluginProviderLoader.getPluginMetadata(JarPluginProviderLoader.java:213)

Not sure yet how to solve the issue with the classloaders and plugins since it looks that plugins are always loaded from the jar (rather than from Eclipse workspace). It would be a pain to create a new jar every time just to make some change instead of doing it within Eclipse itself.

Nothing of this with class loaders is mentioned in the IDE config manuals and, I think, it matters, but maybe I am doing something wrong.....

John Burbridge

unread,
Apr 4, 2013, 2:22:34 PM4/4/13
to rundeck...@googlegroups.com
Hi Adolfo,

Is the goal to setup your Eclipse based development environment to do work on Rundeck proper or one of the plugins? Have you tried setting it up with STS or GGTS and let the Gradle plugin manage and link the projects for you? 

I haven't spent too much time in the launcher app as I'm more interested in the war file and deploying that to a different container, so my scenario may be a bit different from yours. That said...

If you're working on plugins there will still be the extra step of deploying the plugin to $RDECK_BASE/libext, but that should probably be automated from the plugin side (unless you're working on one of the native plugins that's baked into Rundeck).

Cheers,
JB

Adolfo Rodriguez

unread,
Apr 4, 2013, 4:35:03 PM4/4/13
to rundeck...@googlegroups.com
Hi John,

well, yes, you are correct. In order to create new plugins it would not be needed to import the whole project but just the suitable jars to compile the interfaces, and build the plugins on these interfaces.

I though that when I bug is detected, making the fix and contributing a PR could be quicker than waiting to be fixed in next release so I wanted to get familiarized with the core project and run it within Eclipse. Regarding STS I removed the environment from my Eclipse installation some weeks ago because it is too heavy so, no, I have not tested with STS yet. Actually, I supposed it should work by doing a manual install, as usually, and everything works, except the plugins loaded which a custom CL. But, in the other hand, I cannot see what STS can do to fix the CL issue. Will keep trying anyway.

Thanks.

Adolfo Rodriguez

unread,
Apr 5, 2013, 3:42:03 PM4/5/13
to rundeck...@googlegroups.com
Well, good news. By removing plugin sources from the list of source folders in Eclipse, their .class are not added to the class path in runtime so they do not conflict with the plugins in the jar because of the CL. This fix the exceptions above.

I have got now groovy exceptions with the view, but it makes sense as Groovy is not configured in my Eclipse. I am in sync which what you commented now John. I was an step below.

Problem was adding plugin sources to the class path as they conflicted plugins in the jar.

Regards

Adolfo Rodriguez

unread,
Apr 5, 2013, 4:23:30 PM4/5/13
to rundeck...@googlegroups.com
After adding:

* Groovy Compiler 1.8 Feature and 
* Grrovy Eclipse Feature

from http://groovy.codehaus.org/Install+Groovy-Eclipse+Plugin, rundeck runs perfectly within Eclipse. Luckily, no STS needed.

Thanks.

John Burbridge

unread,
Apr 5, 2013, 4:42:38 PM4/5/13
to rundeck...@googlegroups.com
Wow, that's cool! Can you debug / step-through Grails components like the controllers as well?

Adolfo Rodriguez

unread,
Apr 5, 2013, 10:18:42 PM4/5/13
to rundeck...@googlegroups.com
Hi John,

after you asked, I added the groovy files as source folders to the project (project has Java nature only, no Groovy nature included) and localized the right jars and added to class path to compile these new groovy source files. I set a breakpoint in UserController.groovy#login() and yes my Eclipse Helios allows me debugging (screenshot attached).

I do not know how it compares with capabilities of STS but, yes, I can step-through groovy files. However, I do not think there is any support for Groovy Server Pages.
debug.png

Yunus Dawji

unread,
Feb 15, 2016, 2:02:26 AM2/15/16
to rundeck-discuss, gr...@dtosolutions.com
Hi,

I just setup my IDEA as per your instruction. I was wondering if I want to do plugin development, where should I start writing code and what module do i need to compile as I want to run/debug with new changes.

Greg Schueler

unread,
Feb 15, 2016, 1:33:29 PM2/15/16
to Yunus Dawji, rundeck-discuss
Hi,

If you are just getting started, refer to the example code (https://github.com/rundeck/rundeck/tree/development/examples<https://github.com/rundeck/rundeck/tree/development/examples>) for a starting point, and see the Developer guide (http://rundeck.org/docs/developer/index.html <http://rundeck.org/docs/developer/index.html>).

Build your plugin, and install it in the libext dir of your test Rundeck install.  At that point you can run Rundeck in Debug mode in your IDE to set breakpoints, etc.  To step through your plugin source code in the debugger, you would need to attach the sources of your plugin.  You could create a new module in the Rundeck project in IDEA from your plugin sources for that purpose.
Reply all
Reply to author
Forward
0 new messages