Hi,
I’m trying to import “import com.atlassian.templaterenderer.TemplateRenderer;” into my servlet. I tried the “atlas-create-jira-plugin-module” and choosing “component import” option. But no luck
<component-import key="templaterenderer" interface="com.atlassian.templaterenderer" filter=""/>
Can you someone help me out here how to import this dep?
Hi @VivekBurman1,
in Jira 10 you do not need to manually import services using inside the atlassian-plugin.xml if you are using Atlassian Spring Scanner 2.x
This is deprecated in Spring Scanner 2.x-based plugins , which is required for Jira 9 and 10.
For me this working:
- Add the Correct Dependency
In Jira10 you might need 5.x or the latest available
<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>5.0.0</version> <!-- adjust based on your Jira version (9.x or 10.x) -->
<scope>provided</scope>
</dependency>
- In your Servlet (or component), you should inject TemplateRenderer directly using Spring Scanner, instead of
import com.atlassian.templaterenderer.TemplateRenderer;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import javax.inject.Inject;
import javax.inject.Named;
@Named
public class MyServlet extends HttpServlet {
private final TemplateRenderer templateRenderer;
@Inject
public MyServlet(@ComponentImport TemplateRenderer templateRenderer) {
this.templateRenderer = templateRenderer;
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html;charset=utf-8");
templateRenderer.render("templates/my-template.vm", null, resp.getWriter());
}
}
@ComponentImport tells Spring Scanner to fetch TemplateRenderer from Jira’s core OSGi services.|
@Inject works thanks to Spring Scanner 2.x, which handles injecting Jira-provided services (like TemplateRenderer).|
Hope this helps 
Cheers,
daniel
1 Like
If you’re unable to import TemplateRenderer
in Jira 10.3.x, it could be due to changes in the Jira API or module dependencies. Here are a few troubleshooting steps you can try:
- Check Dependency Imports – Ensure that you have the correct dependencies in your
pom.xml
(if using Maven) or build configuration. Jira API updates may have altered package locations or access permissions.
- Verify API Changes – Review the Jira Developer Documentation to see if
TemplateRenderer
has been deprecated or replaced in version 10.3.x. Some rendering functions may now require different classes or methods.
- Check Plugin Compatibility – If you’re developing a Jira plugin, ensure it’s compatible with Jira 10.3.x and that all necessary modules are correctly enabled in your
atlassian-plugin.xml
.
- Inspect Error Logs – Look at the stack trace or logs to identify any specific import or dependency errors that might provide further insight.