Hey everyone! I’m working on a Jira add-on and I’m stuck. I’ve got a properties file (let’s call it myconfig.properties
) in my project. But once I install the add-on on a Jira instance, I can’t figure out where this file ends up.
Does anyone know how to find the path to resource files after an add-on is installed? I’ve looked through the docs but can’t seem to find a clear answer.
I’m pretty new to Jira development, so any tips or pointers would be super helpful. Thanks in advance for your help!
hey dancingbutterfly, resource files in jira add-ons usually end up inside the jar.
try using getClass().getResourceAsStream(“/myconfig.properties”) to read them. hope it helps!
As someone who’s been developing Jira add-ons for a while, I can share some insights on this. Resource files like your myconfig.properties
are typically bundled within the add-on’s JAR file when it’s installed on a Jira instance. You won’t find them as separate files in the file system.
To access these resources, you should use the classloader instead of trying to locate them on the file system. In your add-on code, you can do something like this:
InputStream inputStream = getClass().getResourceAsStream("/myconfig.properties");
Properties props = new Properties();
props.load(inputStream);
This approach allows you to read the properties file regardless of where it’s physically located. It’s a more reliable method for accessing bundled resources in Jira add-ons.
Remember, if you need to modify these files at runtime, you’ll need to implement a different strategy, such as storing configurable data in the database or Jira’s own configuration system.