How to use properties

Hi!

I’m Pedro and I’m new on this forum. Nice to meet you! If I did something wrong, please tell me. I’m developing an addon for Jira Server. I’m using Atlassian SDK.

So, my question is, how can I use properties on my code? I have three environments (local, PRE, PRO) and in every environment I use different customfields IDs.

Actually I have one .properties
imagen
I supposed that I need three .properties, one for every environment.

So my first question is, what is the name that I have to write in the news .properties?

Then, which is the method or class that I have to use to detect my custom properties in my Java class?

And my last question, how do I have to compile so that it takes one properties or another?

Thank you so much!

Best Regards,
Pedro.

That properties file is provided in the plugin skeleton for i18n, or language internationalization. See https://developer.atlassian.com/server/framework/atlassian-sdk/internationalising-your-plugin/

There is a guide here on pulling properties files in Jira plugins: Plugin Tutorials - J tricks - Little JIRA Tricks

InputStream iStream = ClassLoaderUtils.getResourceAsStream("jtricks.properties", this.getClass());
Properties p = new Properties();
p.load(iStream);

Hi!

Thanks for your fast response!

Okay, right now I can use getText to get my property.
imagen

The first image I’m using getText() and exactly I get the value of my properties (second image, “customfield_10025”). But now, how can I create another properties with the same key but different value?

For example, I have PRE and I want that getText(“customfield.tests”) returns “customfield_10025” but I want that on PRO returns other value, for example “customfield_10189”. How have I to create the new properties? And how have I to compile my program that it takes one properties(PRE) or another(PRO)?

Thank you and best regards,
Pedro.

I upload here the second image.
imagen