How to migrate persistent plugin data (ToolInstallation)

20 views
Skip to first unread message

Martin Weber

unread,
Feb 1, 2016, 3:32:45 PM2/1/16
to jenkins developers
Hi,

I had to rename my sub-class of ToolInstallation.
Could someone tell/help me how to migrate existing persistent data?
I already tried

@Initializer(before=InitMilestone.PLUGINS_STARTED)
public static void addAliases() {
Items.XSTREAM2.addCompatibilityAlias("hudson.plugins.cmake.CmakeTool",
CmakeInstallation.class);


but with no effect.

TIA,
Martin

--
Cd wrttn wtht vwls s mch trsr.


Robert Sandell

unread,
Feb 5, 2016, 6:18:51 AM2/5/16
to jenkin...@googlegroups.com
It might be that it is not Items.XSTREAM2 that is used when deserializing ToolInstallations
There is for example Jenkins.XSTREAM2 as well and maybe some others that I don't remember.

/B

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/2088772.aiN4NoNtN5%40linux.
For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

Martin Weber

unread,
Feb 5, 2016, 5:35:44 PM2/5/16
to jenkin...@googlegroups.com
Am Freitag, 5. Februar 2016, 12:18:48 schrieb Robert Sandell:
> It might be that it is not Items.XSTREAM2 that is used when deserializing
> ToolInstallations
> There is for example Jenkins.XSTREAM2 as well and maybe some others that I
> don't remember.

Next time I'll look at this. For now, I decided to not rename the class and
avoid lots of download traffic from cmake.org.

Jesse Glick

unread,
Feb 8, 2016, 7:40:03 AM2/8/16
to Jenkins Dev
On Fri, Feb 5, 2016 at 6:18 AM, Robert Sandell <rsan...@cloudbees.com> wrote:
> It might be that it is not Items.XSTREAM2 that is used when deserializing ToolInstallations

According to

https://github.com/jenkinsci/cmakebuilder-plugin/blob/83220e7a2c9be23749b13f06b81644e00ac3524b/src/main/java/hudson/plugins/cmake/CmakeTool.java#L149
https://github.com/jenkinsci/jenkins/blob/b7fc9b7ef9b0dc106aa6253784c0e28f91bbc9c2/core/src/main/java/hudson/model/Descriptor.java#L883
https://github.com/jenkinsci/jenkins/blob/b7fc9b7ef9b0dc106aa6253784c0e28f91bbc9c2/core/src/main/java/hudson/XmlFile.java#L117

you are using `DEFAULT_XSTREAM` so I think you would need to do (ick):

new XmlFile(null).getXStream().addCompatibilityAlias("hudson.plugins.cmake.CmakeTool",
CmakeInstallation.class);
Reply all
Reply to author
Forward
0 new messages