Plugin throws no errors, but shows no output

Making a plugin to decorate PR Overview page with links to external, non-Jira stpory mgmt system. Link targets are to be gleaned by scanning PR comment. Plugin installs fine, throws no errors to log, but does not show any content on the page. Testing with atlas-debug specifying BB version 5.2.2. Plugin SDK version 6.2.14. Windows 10 Enterprise.

Had to alter the pom.xml file to change the following dependencies to “provided” and specify version 5.2.2, to overcome “managed” version 4.9.1 from the parent POM:

  • bitbucket-api
  • bitbucket-spi
  • bitbucket-page-objects

Component code shown below. Can anyone tell me why this is failing?

/src/resources/atlassian-plugin.xml:

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="3">
    <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>
    </plugin-info>

    <resource type="i18n" name="i18n" location="versionone-for-bitbucket-plugin"/>

    <client-resource key="pr-overview-resources" name="Pull Request Overview Resources">
        <directory location="/css/" />
        <directory location="/js/" />
        <directory location="/soy/" />

        <dependency>com.atlassian.auiplugin:ajs</dependency>
        <dependency>com.atlassian.bitbucket.server.bitbucket-web-api:pull-request-web-panels</dependency>
    </client-resource>

    <client-web-panel key="comment-create-todo" location="bitbucket.pull-request.related-entities">
        <client-context-provider>gov.ssa.mde.getV1AssetIds</client-context-provider>
<!--         <resource name="view" type="soy" location="${atlassian.plugin.key}:pr-overview-resources/gov.ssa.mde.assetLinks" /> -->
		<view>function(){return "<span style='color: red'>Hello, world!</span>";}</view>
        <dependency>${atlassian.plugin.key}:pr-overview-resources</dependency>
    </client-web-panel>

</atlassian-plugin>

src/main/resources/js/pull-request-overview.js:

(function($) {

	// Set up our namespace
    window.gov = window.gov || {};
    gov.ssa = gov.ssa || {};
    gov.ssa.mde = gov.ssa.mde || {};

//    console.log("pull-request-overview.js has set up the namespaces.")
    
    /*
     * Glean V1 asset ids from context item 'pullRequest'.
     */
    function getV1AssetIds(context) {
//    	console.log("pull-request-overview.getV1AssetIds invoked.");
        const testdata = ["B-04742", "D-01026"];
        return {
        	"assetIds" : testdata
        };
    }
    
    gov.ssa.mde.getV1AssetIds = getV1AssetIds;

//    console.log("pull-request-overview.js exposed its methods.")

}(AJS.$));

src/main/resources/soy/pull-request-overview.soy:

{namespace gov.ssa.mde}

/**
 * @param assetIds
 */
{template .assetLinks}
    {foreach $id in $assetIds}
        {$id} &nbsp;
    {ifempty}
        <span style="color: red">NO LINKS</span>
    {/foreach}
{/template}

HI @steven.m.cason,

I notice your <client-web-panel> does not declare your soy template as a resource, so we can ignore potential soy compilation issues. Your declaration of <view> omits the need for a resource, but typically I see that used to reference the function name found in your declared resources, but could be fine.

As a debugging tip I find that BB sets logging levels very high, so errors like soy rendering tend to get omitted, be sure to enable trace/debug level logging in the admin console to ensure there are not any hidden errors.

Bitbucket has a good tutorial on adding soy template to the PR overview page, https://developer.atlassian.com/bitbucket/server/docs/latest/tutorials-and-examples/pull-request-overview.html which it seems your code closely models - were you able to get that working?

Can you elaborate on your comments about the pom modification? Those dependencies should all be provided scope, but properly align to the version of Bitbucket you are running based on version passed to AMPS plugin/atlas-debug - so that seems odd.

<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.atlassian.bitbucket.server</groupId>
				<artifactId>bitbucket-parent</artifactId>
				<version>${bitbucket.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
...
		<dependency>
			<groupId>com.atlassian.sal</groupId>
			<artifactId>sal-api</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.atlassian.bitbucket.server</groupId>
			<artifactId>bitbucket-api</artifactId>
			<scope>provided</scope>
		</dependency>
...

	<properties>
		<bitbucket.version>5.2.2</bitbucket.version>

Thanks for your review, ollitech. In re the POM modification, when I switch the dependencies to “provided” with no version specification, BB fails to enable bitbucket-it-resources-4.9.1.jar as well as my plugin. Screencap:

Trying to eliminate runtime errors by manipulating version for Maven. Ended up removing version 4.9.1 from local Maven repo.

In re logging: that helped. Found I had to include execute_java permission.

Now, no ERROR logs to console, but still no output, either.

ollitech, I actually started by cloning the project mentioned at the PR overview tutorial you cited. I then removed a bunch of JS code that persists todo items, shows the Add TODO form, and so forth, and changed the context provider and soy template. The original code worked just fine on my system. The code I posted above isn’t even trying to do anything with context or soy templates. I just want to get it to add “Hello, world!” in red to the specified location.