Bitbucket Version Incompatibility using Atlassian Plugin Java SDK
Asked by Jiawei Zhu:

Hi All!

I downloaded the newest Atlassian Plugin Java SDK from the following tutorial.

<https://developer.atlassian.com/server/framework/atlassian-sdk/set-up-the-atlassian-plugin-sdk-and-build-a-project/>

I used this Java SDK to develop a custom Bitbucket plugin. Now I am trying to deploy my custom plugin to a Bitbucket server with version of 6.10.10. However, I find this SDK uses Bitbucket version 5.16.0. When I run my plugin on the 6.10.10 Bitbucket server, it throws some incompatibility errors. I wonder if there is a way to update the bitbucket version in this Java SDK to 6.10.10?

Any help is greatly appreciated!

Thanks!


Answers:
author: Maciej Adamczak
body: Hi [@Jiawei Zhu](/t5/user/viewprofilepage/user-id/4336228)

If you want to change the local version of the Bitbucket in your plugin you can modify the "pom.xml" file:

```
...
 <build>
   <plugins>
     <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>bitbucket-maven-plugin</artifactId>
        <version>${amps.version}</version>
        <extensions>true</extensions>
        <configuration>
           <products>
             <product>
               <id>bitbucket</id>
               <instanceId>bitbucket</instanceId>
               <version>6.10.10</version> <!-- set the Bitbucket versions here -->
               <dataVersion>6.10.10</dataVersion>
             </product>
           </products>
```

You can also use the "atlas-run command with additional params:

```
atlas-run --product bitbucket --version 6.10.10
```

<https://developer.atlassian.com/server/framework/atlassian-sdk/atlas-run/>

Thanks,  
Maciej Adamczak

comments: author: Jiawei Zhu
body: Thanks, Maciej! I have changed the version number to 6.10.10 in the pom.xml file. After I run the atlas-run command as suggested above, the project fails to build. It shows that the 'init' method does not exist in SpringApplication. I wonder if I need to update the spring dependency also? The error logging is shown as below.

```
[INFO] Configured Artifact: com.atlassian.bitbucket.search:embedded-elasticsearch-plugin:6.1.0:jar
[INFO] Copying embedded-elasticsearch-plugin-6.1.0.jar to C:\Users\zhuji1\Downloads\is-admin-merge-check\target\bitbucket\app\WEB-INF\atlassian-bundled-plugins\embedded-elasticsearch-plugin-6.1.0.jar
[INFO] Exception in thread "main" java.lang.reflect.InvocationTargetException
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
[INFO] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
[INFO] at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
[INFO] at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:58)
[INFO] Caused by: java.lang.NoSuchMethodError: org.springframework.boot.SpringApplication.<init>([Ljava/lang/Class;)V
[INFO] at com.atlassian.bitbucket.internal.boot.BitbucketServerApplication.start(BitbucketServerApplication.java:264)
[INFO] at com.atlassian.bitbucket.internal.boot.BitbucketServerApplication.main(BitbucketServerApplication.java:87)
[INFO] ... 8 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.552 s
[INFO] Finished at: 2021-04-15T16:59:16-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.atlassian.maven.plugins:amps-dispatcher-maven-plugin:8.1.0:run (default-cli) on project is-admin-merge-check: Bitbucket Server failed to start: Java returned: 1 See log for details. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.atlassian.maven.plugins:amps-dispatcher-maven-plugin:8.1.0:run (default-cli) on project is-admin-merge-check: Bitbucket Server failed to start
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Bitbucket Server failed to start
at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.waitUntilReady (BitbucketProductHandler.java:449)
at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.startApplication (BitbucketProductHandler.java:276)
at com.atlassian.maven.plugins.amps.product.AbstractProductHandler.start (AbstractProductHandler.java:89)
at com.atlassian.maven.plugins.amps.RunMojo.startProducts (RunMojo.java:137)
at com.atlassian.maven.plugins.amps.RunMojo.doExecute (RunMojo.java:84)
at com.atlassian.maven.plugins.amps.AbstractProductHandlerMojo.execute (AbstractProductHandlerMojo.java:780)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo (MojoExecutor.java:119)
at com.atlassian.maven.plugins.amps.util.MojoUtils.execute (MojoUtils.java:36)
at com.atlassian.maven.plugins.amps.util.MojoUtils.executeWithMergedConfig (MojoUtils.java:66)
at com.atlassian.maven.plugins.ampsdispatcher.AbstractAmpsDispatcherMojo.execute (AbstractAmpsDispatcherMojo.java:56)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.tools.ant.BuildException: Java returned: 1 See log for details.
at com.atlassian.maven.plugins.amps.util.ant.AntJavaExecutorThread.run (AntJavaExecutorThread.java:110)?
```


author: Maciej Adamczak
body: I think you need to first run the "atlas-clean" command to remove any leftover files from the previous version.


author: Jiawei Zhu
body: Thanks!! Now the server is running.


Tags: atlassian-sdk

bitbucket-development

bitbucket-server

java

server

version