Hi,

Does properties file format mandatory for you?
If not, you can try yaml format and readYaml will provide you object.

Arnaud.

Le mar. 29 janv. 2019 à 23:17, Alejandro Moncayo <
[email protected]> a écrit :

> After searching around for examples and not finding good ones, I have this
> one:
>
> A sample text properties file with this data:
> property1=value1
> property2=value2
> property3=value3
>
> and my pipeline looks like:
> ///////////////////////////
> //Pipeline starts here
> /////////////////
> import groovy.io.FileType
> import groovy.json.*
> import hudson.model.Result
> import java.util.Properties
>
> node {
>     Properties properties = new Properties()
>
>     configFileProvider([configFile(fileId: 'asq213', variable:
> 'fileLocation')]) {
>         File propertiesFile = new File("${env.fileLocation}")
>         properties.load(propertiesFile.newDataInputStream())
>     }
>
>         println properties.property1
>         println properties.property2
>         println properties.property3
> }
>
> ///////////////////////////
> //Pipeline ends here
> /////////////////
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" 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-users/31936bde-2b08-499a-b75f-b89aae987684%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/31936bde-2b08-499a-b75f-b89aae987684%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" 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-users/CAESUf_ATcmwdHnCuiaLOx057fHHVgaR%3D0g7EX9005BrdSysfqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to