How to install plugin with CSE?

Hello!

I have difficulties installing my plugin to Butbucket Server v7.6.0.

I have a plugin with CSE (button). I have built it with:

npm run-script build:prod
atlas-package

bitbucket-maven-plugin is configured as the following:

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>bitbucket-maven-plugin</artifactId>
    <version>${amps.version}</version>
    <extensions>true</extensions>
    <configuration>
        <compressJs>false</compressJs>
        <compressCss>false</compressCss>
        <enableQuickReload>true</enableQuickReload>
        <products>
            <product>
                <id>bitbucket</id>
                <instanceId>bitbucket</instanceId>
                <version>${bitbucket.version}</version>
                <dataVersion>${bitbucket.data.version}</dataVersion>
            </product>
        </products>
        <pluginDependencies>
            <pluginDependency>
                <groupId>com.atlassian.plugins</groupId>
                <artifactId>atlassian-clientside-extensions-page-bootstrapper</artifactId>
            </pluginDependency>
        </pluginDependencies>
        <instructions>
            <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
            <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
            <Import-Package>
                            com.atlassian.plugin.clientsideextensions;version="${cse.version}",
                            com.atlassian.plugin.osgi.bridge.external,
                            *
            </Import-Package>
            <Spring-Context>*</Spring-Context>
        </instructions>
        <pluginArtifacts>
            <pluginArtifact>
                <groupId>com.atlassian.plugins</groupId>
                <artifactId>atlassian-clientside-extensions-page-bootstrapper</artifactId>
                <version>${cse.version}</version>
            </pluginArtifact>
        </pluginArtifacts>
    </configuration>
</plugin>
...
<properties>
      <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
      <frontend.maven.plugin.version>1.6</frontend.maven.plugin.version>
      <frontend.maven.plugin.install.directory>${project.build.directory}</frontend.maven.plugin.install.directory>
      <nodeVersion>v12.13.0</nodeVersion>
      <fe.cmd.install>install --no-progress</fe.cmd.install>
      <fe.cmd.build>build:prod</fe.cmd.build>
      <fe.cmd.build.dev>build:dev</fe.cmd.build.dev>
      <frontend.working.directory>src/main/bpmn-diff-bitbucket-plugin</frontend.working.directory>
      <cse.version>1.2.0</cse.version>

      <sal.version>4.0.0</sal.version>
      <spring.version>5.0.10.RELEASE</spring.version>
      <atlassian.spring.scanner.version>2.1.9</atlassian.spring.scanner.version>
      <atlassian.plugins.version>5.2.1</atlassian.plugins.version>
      <amps.version>8.0.0</amps.version>
      <soy.version>5.0.0</soy.version>
      <webfragments.version>5.1.0</webfragments.version>
      <webresources.version>4.1.3</webresources.version>
      <jsonapi.version>0.11</jsonapi.version>
      <gson.libversion>2.3.1</gson.libversion>

      <bitbucket.version>7.4.0</bitbucket.version>
      <bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
      <bitbucket.osgi.version>7.0.0</bitbucket.osgi.version>
      <bitbucket.api.version>7.2.2</bitbucket.api.version>

      <atr.version>4.0.0</atr.version>

      <quick.reload.version>3.0.0</quick.reload.version>
</properties>

I have “Atlassian Plugins - Client-side Extensions - Runtime” system app installed (Version: 1.2.0) with all 4 modules enabled.

I have “Atlassian Plugins - Client-side Extensions - Page Bootstrapper” user-installed app installed (Version: 1.2.3) with all 5 modules enabled.

And I have my plugin installed with all modules enabled. I can see all the apps on the Manage apps page.

Everything looks fine except I don’t see the expected CSE button. And I don’t see any errors or warning in the server logs.

I can see the button when I run my plugin locally. So I was wondering what is the correct way to install it? Or is there a problem with the way I build the plugin artifact? Or is there a problem with plugin setting or versions?

Hi @YaroslavRudykh,

What you can do to verify if the extension is working fine:

  1. Check again if all the plugin modules are installed and enabled under the Manage apps page.
  2. Open the pull request page and turn on the browser devtools. If you see any errors in the console panel or network tab this might be related to a missing extension.
  3. To verify if the JS file from the extension is loaded on the page, install the ASD Chrome extension.
    1. Go to the pull request page.
    2. If the extension point is located in a different tab, e.g. Diff tab then select this tab on the page.
    3. Open browser devtools and select the ASD tab.
    4. Next, you can verify if the extension code is loaded using those steps:

Let me know if you have found any additional information we can use to help you.

One more thing. If you don’t plan to use the PageExtension you can remove the page-bootstrapper dependency. Here is the short instruction on how to do it: Bitbucket

Check the Removing page-bootstrapper section.

Thanks,
Maciej Adamczak

@madamczak, thank you for the reply! An I am sorry for the delay. I had to switch to other tasks for some time.

I have followed your instructions. I have checked Manage apps page and verified the plugin and all its modules are enabled.

I have also installed the ASD Chrome extension and tried to search for the extension on the page I expect it to be applied to by its id and it looks like it is not loaded.

And another observation… I’ve tried to do the same locally (I can see the expected button on the right place locally). The plugin tab on the Manage apps page looks different:

And I can see the extension code with the ASD extension:

@madamczak, I’ve also tried to remove page-bootsrapper as you suggested. But after that I’ve started getting the following error on startup:

[INFO] 2021-02-18 15:18:17,862 ERROR [spring-startup]  c.a.plugin.osgi.factory.OsgiPlugin Detected an error (BundleException) enabling the plugin 'ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin' : Unable to resolve ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0): missing requirement [ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.0)) Unresolved requirements: [[ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.0))].  This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN
[INFO] 2021-02-18 15:18:17,862 WARN  [spring-startup]  c.a.plugin.impl.AbstractPlugin Unable to enable plugin 'ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin'
[INFO] 2021-02-18 15:18:17,867 WARN  [spring-startup]  c.a.plugin.impl.AbstractPlugin Because of this exception
[INFO] com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin
[INFO] 	at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:424)
[INFO] 	at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:252)
[INFO] 	at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:120)
[INFO] 	at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:97)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$enableDependentPlugins$22(DefaultPluginManager.java:1243)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1227)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$20(DefaultPluginManager.java:1212)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1112)
[INFO] 	at com.atlassian.stash.internal.plugin.StashPluginManager.addPlugins(StashPluginManager.java:79)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$earlyStartup$3(DefaultPluginManager.java:587)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.earlyStartup(DefaultPluginManager.java:522)
[INFO] 	at com.atlassian.stash.internal.plugin.StashPluginManager.lambda$earlyStartup$0(StashPluginManager.java:54)
[INFO] 	at com.atlassian.stash.internal.plugin.PluginUpgradeHelper.withUpgrade(PluginUpgradeHelper.java:76)
[INFO] 	at com.atlassian.stash.internal.plugin.StashPluginManager.earlyStartup(StashPluginManager.java:54)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$init$2(DefaultPluginManager.java:514)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:513)
[INFO] 	at com.atlassian.stash.internal.plugin.SpringPluginSystemLifecycle.start(SpringPluginSystemLifecycle.java:35)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
[INFO] 	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894)
[INFO] 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
[INFO] 	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
[INFO] 	at java.lang.Thread.run(Thread.java:748)
[INFO] 	... 8 frames trimmed
[INFO] Caused by: org.osgi.framework.BundleException: Unable to resolve ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0): missing requirement [ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.0)) Unresolved requirements: [[ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.0))]
[INFO] 	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)
[INFO] 	... 30 common frames omitted
[INFO] 2021-02-18 15:18:17,875 ERROR [spring-startup]  c.a.plugin.manager.PluginEnabler Unable to enable plugin ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin
[INFO] com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin
[INFO] 	at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:424)
[INFO] 	at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:252)
[INFO] 	at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:120)
[INFO] 	at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:97)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$enableDependentPlugins$22(DefaultPluginManager.java:1243)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1227)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$20(DefaultPluginManager.java:1212)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1112)
[INFO] 	at com.atlassian.stash.internal.plugin.StashPluginManager.addPlugins(StashPluginManager.java:79)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$earlyStartup$3(DefaultPluginManager.java:587)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.earlyStartup(DefaultPluginManager.java:522)
[INFO] 	at com.atlassian.stash.internal.plugin.StashPluginManager.lambda$earlyStartup$0(StashPluginManager.java:54)
[INFO] 	at com.atlassian.stash.internal.plugin.PluginUpgradeHelper.withUpgrade(PluginUpgradeHelper.java:76)
[INFO] 	at com.atlassian.stash.internal.plugin.StashPluginManager.earlyStartup(StashPluginManager.java:54)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.lambda$init$2(DefaultPluginManager.java:514)
[INFO] 	at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] 	at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:513)
[INFO] 	at com.atlassian.stash.internal.plugin.SpringPluginSystemLifecycle.start(SpringPluginSystemLifecycle.java:35)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
[INFO] 	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
[INFO] 	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894)
[INFO] 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
[INFO] 	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
[INFO] 	at java.lang.Thread.run(Thread.java:748)
[INFO] 	... 8 frames trimmed
[INFO] Caused by: org.osgi.framework.BundleException: Unable to resolve ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0): missing requirement [ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.0)) Unresolved requirements: [[ru.domclick.bitbucket.bpmn-diff-bitbucket-plugin [134](R 134.0)] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.plugin.clientsideextensions)(version>=1.2.0))]
[INFO] 	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)
[INFO] 	... 30 common frames omitted

Thanks, I’ve sent you the DM.

Hey @YaroslavRudykh, we have managed to find the root cause of the problem. I reported the issue here: [CSE-107] - Ecosystem Jira. We will be working on the fix shortly.

The new version of CSE with a fix should be released this week.

Thanks
Maciej Adamczak
Atlassian Developer