soy template rendering problem

Arikrishnan November 2, 2023

Hello Guys,

I have a confluence macro that is working fine in Confluence version 7.x 

Now I am going to upgrade my macro to support confluence 8.x (8.6.0), I am facing a few issues while upgrading it.

I am trying to create my own custom macro dialog using a soy template. I followed a tutorial which helped me to get the publishing and rendering working properly. However, after I edited some of my Confluence pages that contain macros, the soy template was not able to render properly the first time (as shown in Screen 2). But, once I refreshed the page and made further edits, the macro soy template started working properly (as shown in Screen 4).

 

Screen 1: Edit option Show

image.png

Screen 2: Edit option-click default template showing 

image.png

 

Screen 3: The Page refresh after the edit button not showing. but double tab click edit page open. with soy, template should be rendered properly on screen 4

image.png

 

Screen 4:

image.png

 

1.This is my POM.xml file


<?xml version="1.0" encoding="UTF-8"?>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.prolaborate.macros</groupId>
    <artifactId>prolaborate-macro</artifactId>
    <version>3.5</version>
    <organization>
        <name>Prolaborate Pvt Ltd</name>
    </organization>
    <name>prolaboratemacro</name>
    <description>Prolaborate macro for Confluence lets you create dynamic and self-refreshing Sparx Enterprise Architect Model based pages in Confluence.</description>
    <packaging>atlassian-plugin</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence-plugins-platform-pom</artifactId>
<version>${confluence.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
    <dependencies>
    <dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.1</version>
  <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.5.0</version>
<scope>provided</scope>
</dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>
<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
  <scope>provided</scope>
</dependency>
        <!-- WIRED TEST RUNNER DEPENDENCIES -->
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
            <version>${plugin.testrunner.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.9</version>
        </dependency>
<dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <version>1.0.2</version>
            <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.15.2</version>
</dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>confluence-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${confluence.version}</productVersion>
                    <productDataVersion>${confluence.data.version}</productDataVersion>
                    <enableQuickReload>true</enableQuickReload>
                    <enableFastdev>false</enableFastdev>
<compressJs>false</compressJs>
<compressResources>false</compressResources>
                    <!-- See here for an explanation of default instructions: -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <!-- Add package to export here -->
                        <Export-Package>
                            com.prolaborate.macros.api,
                        </Export-Package>
                        <!-- Add package import here -->
                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            *;version="0";resolution:="optional"
                        </Import-Package>
                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
<containerId>${containerId}</containerId>
<jvmArgs>${jvm.args}</jvmArgs>
<systemPropertyVariables>
<webdriver.browser>${webdriver.browser}</webdriver.browser>
<atlassian.dev.mode>${atlassian.dev.mode}</atlassian.dev.mode>
</systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian.spring.scanner.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.plugin</groupId>
                            <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                        </dependency>
                    </scannedDependencies>
                    <verbose>false</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <confluence.version>8.6.0</confluence.version>
        <confluence.data.version>8.6.0</confluence.data.version>
        <amps.version>8.9.2</amps.version>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
<jvm.args.custom/> <!-- Allows to specify custom arguments in build scripts -->
<jvm.args.xmx>1024m</jvm.args.xmx>
<jvm.args>-Xmx${jvm.args.xmx} ${jvm.args.custom}</jvm.args>
<containerId>tomcat9x</containerId>
<webdriver.browser>chrome</webdriver.browser>
<atlassian.dev.mode>false</atlassian.dev.mode>
    </properties>
</project>

2.This is my atlassian-plugin.XML file

<?xml version="1.0" encoding="UTF-8"?>
<atlassian-plugin key="${atlassian.plugin.key}" name="Prolaborate" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
<param name="plugin-banner">images/1120x548.png</param>
<param name="vendor-icon">images/pluginIcon.png</param>
<param name="vendor-logo">images/pluginLogo.png</param>
<param name="configure.url">/plugins/servlet/prolaborate/admin</param>
<param name="post.install.url">/plugins/servlet/prolaborate/admin</param>
<param name="atlassian-data-center-status">compatible</param>
<param name="atlassian-data-center-compatible">true</param>
<param name="read-only-access-mode-compatible">true</param>
<param name="plugin-type">both</param>
</plugin-info>
<xhtml-macro name="prolaborate" class="com.prolaborate.macros.Integration" key="prolaborate-integration">
<category name="formatting" />
<parameters>
<parameter name="Name" type="string">
<option key="showNameInPlaceholder" value="false" />
<option key="showValueInPlaceholder" value="true" />
</parameter>
<parameter name="Type" type="enum">
<value name="Element" />
<value name="Diagram" />
<value name="Discussions" />
<option key="showNameInPlaceholder" value="false" />
<option key="showValueInPlaceholder" value="true" />
</parameter>
<parameter name="Guid" type="string">
<option key="showValueInPlaceholder" value="false" />
</parameter>
</parameters>
</xhtml-macro>
<servlet key="admin-servlet" class="com.prolaborate.configureui.AdminServlet">
<url-pattern>/prolaborate/admin</url-pattern>
</servlet>
<rest key="rest" path="/prolaborate-admin" version="1.0">
<description>Provides REST resources for the prolaborate configuration UI.</description>
</rest>
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="prolaboratemacro" />
<!-- add our web resources -->
<web-resource key="prolaboratemacro-resources" name="prolaboratemacro Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-tooltips</dependency>
<resource type="download" name="prolaboratemacro.css" location="/css/prolaboratemacro.css" />
<resource type="download" name="font-awesome.min.css" location="prolaboratemacro/includes/diagramview/font-awesome-4.7.0/css/font-awesome.min.css" />
<resource type="download" name="fontawesome-webfont.woff2" location="prolaboratemacro/includes/diagramview/font-awesome-4.7.0/fonts/fontawesome-webfont.woff2" />
<resource type="download" name="fontawesome-webfont.woff" location="prolaboratemacro/includes/diagramview/font-awesome-4.7.0/fonts/fontawesome-webfont.woff" />
<resource type="download" name="fontawesome-webfont.ttf" location="prolaboratemacro/includes/diagramview/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf" />
<resource type="download" name="fontawesome-webfont.svg" location="prolaboratemacro/includes/diagramview/font-awesome-4.7.0/fonts/fontawesome-webfont.svg" />
<resource type="download" name="switchery.min.css" location="prolaboratemacro/includes/elementview/switchery-master/switchery.min.css" />
<resource type="download" name="switchery.min.js" location="prolaboratemacro/includes/elementview/switchery-master/switchery.min.js" />
<resource type="download" name="prolaboratemacro.js" location="/js/prolaboratemacro.js" />
<resource type="download" name="images/" location="/images" />
<context>prolaboratemacro</context>
</web-resource>
<web-resource key="prolaboratemacro-displayresources" name="prolaboratemacrodisplay Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-tooltips</dependency>
<resource type="download" name="images/" location="/images" />
<context>prolaboratemacro</context>
</web-resource>
<web-resource key="prolaboratemacro-diagramresources" name="prolaboratemacrodisplay diagram Resources">
<context>com.prolaborate.macros.prolaborate-macro:prolaboratemacro-diagramresources</context>
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-tooltips</dependency>
<resource type="download" name="prolaboratemacro.css" location="/css/prolaboratemacro.css" />
<resource type="download" name="prolaboratemacroerror.css" location="/css/prolaboratemacroerror.css" />
<resource type="download" name="prolaboratemacropage.css" location="/css/prolaboratemacropage.css" />
<resource type="download" name="diagramview/" location="prolaboratemacro/includes/diagramview/" />
<resource type="download" name="diagram.js" location="/js/diagram.js" />
<resource type="download" name="img/" location="prolaboratemacro/includes/elementview/PBIconSet/img" />
<resource type="download" name="images/" location="/images" />
<resource type="download" name="View/" location="/View" />
</web-resource>
<web-resource key="prolaboratemacro-elementresources" name="prolaboratemacrodisplay element Resources">
<context>com.prolaborate.macros.prolaborate-macro:prolaboratemacro-elementresources</context>
<dependency>com.atlassian.auiplugin:aui-tooltips</dependency>
<resource type="download" name="prolaboratemacro.css" location="/css/prolaboratemacro.css" />
<resource type="download" name="elementview/" location="prolaboratemacro/includes/elementview/" />
<resource type="download" name="element.js" location="/js/element.js" />
<resource type="download" name="img/" location="prolaboratemacro/includes/elementview/PBIconSet/img" />
<resource type="download" name="images/" location="/images" />
<resource type="download" name="View/" location="/View" />
<context>prolaboratemacro</context>
</web-resource>
<web-resource key="editorWebResource" name="Editor Web Resource">
<context>editor</context>
<dependency>com.atlassian.confluence.tinymceplugin:editor-resources</dependency>
<resource name="images/" type="download" location="prolaboratemacro/includes/editor/images" />
<resource type="download" name="editor.css" location="prolaboratemacro/includes/editor/css/editor.css" />
<resource type="download" name="switchery.min.css" location="prolaboratemacro/includes/elementview/switchery-master/switchery.min.css" />
<resource type="download" name="switchery.min.js" location="prolaboratemacro/includes/elementview/switchery-master/switchery.min.js" />
</web-resource>
<web-resource name="Resources - handle macros with JS" key="macroeditor-resources">
<description>Prolaborate Macro related JS resources</description>
<context>page</context>
<!-- transform calls to AJS.getText() inside JS files -->
<transformation extension="js">
<transformer key="jsI18n" />
</transformation>
<!-- transform Soy templates into JS -->
<transformation extension="soy">
<transformer key="soyTransformer">
<functions>com.atlassian.confluence.plugins.soy:soy-core-functions</functions>
</transformer>
</transformation>
<!-- JS for custom macro gui without using macro browser (for prolaborate macro) -->
<resource name="template-soy.js" type="download" location="soytemplate/prolaboratemacro.soy" />
<resource type="download" name="select2.min.css" location="prolaboratemacro/includes/elementview/select2/css/select2.min.css" />
<resource type="download" name="select2.min.js" location="prolaboratemacro/includes/elementview/select2/js/select2.min.js" />
<resource type="download" name="moment.min.js" location="prolaboratemacro/includes/elementview/moment/2.29.4/moment.min.js" />
<resource type="download" name="macroeditor.js" location="js/macroeditor.js" />
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-dialog2</dependency>
<dependency>com.atlassian.auiplugin:aui-tabs</dependency>
</web-resource>
<web-item key="conf-menu-item" name="Prolaborate Configuration" section="system.admin/marketplace_confluence" weight="10">
<description>Link to prolaborate configuration page.</description>
<label key="prolaborate.admin.title" />
<link linkId="xproduct-admin-link">/plugins/servlet/prolaborate/admin</link>
</web-item>
<web-item key="editor-prolaboratemacrolinkkey" name="Prolaborate" section="system.editor.featured.macros.default" weight="11">
<label key="Prolaborate" />
<link linkId="prolaborate" />
</web-item>
</atlassian-plugin>


How can I solve this problem? 

I'm not sure what I'm missing, so if anyone can help, that would be great.

Please let me know if you require any additional details from my end.

Any support you can give would be greatly appreciated.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events