Status: Closed (View Workflow)
pull request https://github.com/jenkinsci/fitnesse-plugin/pull/3 introduced a way to select the JDK used for starting a fitnesse instance: "The plugin provides a dropdown of Jenkins installed JDKs, unless only one is installed, in which case the default is used."
The default JDK selection strategy does not work. On installations with less than two JDKs configured, after upgrading to fitnesse 1.8
- running an existing job fails with a NPE, see attachment
- saving a new job or updating an existing job fails with net.sf.json.JSONException: JSONObject["fitnesseJdk"] not found, see attachment
Steps to reproduce:
1. add Fitnesse-Plugin 1.8 to a fresh Jenkins installation
2. create a free stye job
3. Add an "Execute fitnesse tests" build step with the option
"Start new Fitnesse instance as part of build".
Fill all required fields. You can use dummy data.
4. save configuration => net.sf.json.JSONException: JSONObject["fitnesseJdk"] not found.
5. define a JDK in Jenkins global configuration
6. repeat steps 3.-4. The same exception will be thrown
7. define a second JDK in Jenkins global configuration
8. repeat steps 3.-4. The job will be saved as expected.
Code changed in jenkins
List JDKs even if there is only one, to ensure a value is always set.
Code changed in jenkins
Merge pull request #11 from hrabbouh/master
Thanks to @lessonz for PR#11, included in Hudson Fitnesse plugin 1.9.
This change still doesn't handle the case where no java installation is configured at all (as described in the steps to reproduce section above).
Jenkins can handle this situation by falling back to the default java shell command.
You can, for example, perform Maven builds under theses conditions.
In such a case, the JDK selection is missing from the Execute fitnesse tests build step configuration. Submitting the configuration leads to a blank page with an unspecific exception being logged to the console, see fitnesse-stacktrace.txt.
Release 1.9, however is a big improvement as it resolves the issue for the case with one installed JDK.
So, this issue should be changed to something like "use system JDK if no JDK is configured"
All thanks should go to @hrabbouh. If he'd like to address this great, otherwise I may take a look at some point, but I'm not sure when. While I appreciate other plugins can support this situation, and I'm willing to merge a pull request with the solution, I'm not thrilled with the idea of defaulting to some "anonymous" system java.
Submitted Pull Request #11 - https://github.com/jenkinsci/fitnesse-plugin/pull/11