So far, I've wrote this code:
        CifsPublisherPluginDescriptor config =
(CifsPublisherPluginDescriptor) Jenkins.getInstance().getDescriptor(
CifsPublisherPlugin.class );
        boolean found = false;
        for (CifsHostConfiguration c : config.getHostConfigurations())
            found = "TEST".equals(c.getName());
        if (!found)
        {
            CifsHostConfiguration configuration = new
CifsHostConfiguration("nicename", "hostname", "user", "password",
"shareName", 445, 30000);
            config.getHostConfigurations().add(configuration);
        }

But then, Jenkins throws in this way:

Caused by: java.lang.UnsupportedOperationException
        at 
java.util.Collections$UnmodifiableCollection.add(Collections.java:1055)
        at 
org.jenkinsci.plugins.greenproject.GreenProject.<init>(GreenProject.java:63)
        at 
org.jenkinsci.plugins.greenproject.GreenProject$GreenProjectDescriptor.newInstance(GreenProject.java:96)



Le Fri Jan 30 2015 at 3:07:29 PM, Ivo Bellin Salarin <
[email protected]> a écrit :

> Hello everybody,
>
> Is there a way to add a BapHostConfiguration (or a CifsHostConfiguration
> which extends BapHostConfiguration) to the system configuration,
> programmatically?
>
> This goes far beyond my knowledge regarding Jenkins internals...
>
> Thanks in advance,
> Ivo
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF82q-B5dvc7a%2Bw8BhWSaQ0y6%2BgTA%3Dd1M4eGJZwCAt7%2BxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to