Our production bitbucket is in version 4.11. I would like to create a plugin for it. However my downloaded sdk is in version 6.3.10, and it support bitbucket 5.8. It gave error of the following when try to run 'atlas-run-standalone --product bitbucket --version 4.11':
Downloading: file:///usr/share/atlassian-plugin-sdk-6.3.10/repository/com/atlassian/bitbucket/server/bitbucket-webapp/4.11/bitbucket-webapp-4.11.war
Downloading: http://repo.maven.apache.org/maven2/com/atlassian/bitbucket/server/bitbucket-webapp/4.11/bitbucket-webapp-4.11.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.968 s
[INFO] Finished at: 2018-06-26T17:25:20-08:00
[INFO] Final Memory: 27M/314M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.atlassian.maven.plugins:maven-amps-plugin:6.3.15:run-standalone (default-cli) on project mergeCheck: Unable to execute mojo: Unable to find artifact. Could not find artifact com.atlassian.bitbucket.server:bitbucket-webapp:war:4.11 in atlassian-public (https://maven.atlassian.com/repository/public)
Do I need to get an older sdk that support bitbucket 4.11? If so, where?
I'd start from an open source plugin already known to work on Bitbucket 4.11 and either study their pom.xml and their src/main/resources/atlassian-plugin.xml, or even copy/paste those two files and start editing them to meet my needs.
The old "cha55son/stash-commit-graph-plugin" is pretty minimal, so it might make a good starting point. But there are lots of others (e.g., yet-another-commit-checker).
After cloning, remember to jump back in time to a pre Bitbucket 5.0 version.
This works fine on my machine!
git clone https://github.com/cha55son/stash-commit-graph-plugin.git
cd stash-commit-graph-plugin
git log --first-parent
# Look for commit just before Bitbucket 5.x compatibility work
# (turns out tag "v2.1" points to the last Bitbucket 4.x version)
git checkout v2.1
# Edit pom.xml to adjust these to 4.11.0
# <bitbucket.version>4.0.2</bitbucket.version>
# <bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
# And then...
atlas-clean
atlas-run
- Sylvie @ Bit-Booster
We develop and maintain three add-ons.
1. Control Freak, 2. Git Graph for JIRA, 3. Rebase Squash Amend (paid)
Thank you, Sylvie, I'll give it a try. However, I'm still a bit puzzled. It sounds to me the problem you think is with the pom file of the plugin I provided. Then it should work if I run the standalone product without installing any plugin I created. But it's not. I tried running 'atlas-run-standalone --product bitbucket --version 4.11.0', and it gave the same fatal error when I access the url it provided in the end: http://C02G7417DRJM.local:7990/bitbucket.
A fatal error has occurred
The following problem occurred, which prevents Atlassian Bitbucket from starting:
SpringMVC dispatcher [springMvc] could not be started
It looks like it tried to use data version 5.11 for this run, which may require springMVC dispatcher. How to choose a stable data version for BB 4.11.0?
[INFO] Starting bitbucket... (see log at /Users/vzhang/amps-standalone/target/bitbucket-LATEST.log)
[INFO] determining latest stable data version...
[INFO] using latest stable data version: 5.11.1
[INFO] Configured Artifact: com.atlassian.bitbucket.server:bitbucket-it-resources:5.11.1:zip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, I only ever run "atlas-run" with no arguments.
I've never used "atlas-run-standalone" nor have I ever used "--product" or "--version" arguments.
In a separate tab I sometimes run "atlas-package" (with no arguments) to publish hot updates to my "atlas-run" process, since it appears to monitor ./target for changes, and so that's a great way to iterate, since you don't need to do a full shutdown/startup to try out your latest change.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The reason I'm a little keen on that is I want to make sure it works on our relatively old production version of bitbucket. I noticed the pom file has bitbucket version specified as 5.11.0, and especially bitbucket added springMVC after 5.0.
If you have some source file for your plugin, what command do you use to package them and upload it to add-ons? I want to try some working ones under the current sdk I installed on our production server, so I know whether it's going to work before I add more code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You probably missed this step:
# Look for commit just before Bitbucket 5.x compatibility work
# (turns out tag "v2.1" points to the last Bitbucket 4.x version)
git checkout v2.1
As well as this step:
# Edit pom.xml to adjust these to 4.11.0
# <bitbucket.version>4.0.2</bitbucket.version>
# <bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
For my own add-ons when it's time to finally publish them or upload them into my demo instance (vm.bit-booster.com/bitbucket), I do this:
atlas-package
After that completes I upload "./target/my-plugin.jar" using my production instance's "settings -> manage add-ons" page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sylvie,
Thank you for your clear instruction. I picked an old plugin for bitbucket, and only change the bitbucket version from 4.7.1 to 4.11.0. I was able to run atlas-run and bring up the application with the plugin. The issue I'm still facing is the eclipse. It cannot resolve all the atlassian libraries. This make it very hard for me to implement new changes in Eclipse. The errors I'm getting when run 'mvn -U clean install' is the following: (I'm try to update my local maven repo)
[ERROR] The project com.atlassian.bitbucket.plugin:pull-request-author-merge-check-plugin:0.1.0-SNAPSHOT (/home/vzhang/workspace/atlassianlabs-stash-pull-request-author-merge-check-plugin-f6428ae9b5c6/pom.xml) has 3 errors
[ERROR] Unresolveable build extension: Plugin com.atlassian.maven.plugins:bitbucket-maven-plugin:6.2.3 or one of its dependencies could not be resolved: Could not find artifact com.atlassian.maven.plugins:bitbucket-maven-plugin:jar:6.2.3 in central (https://repo.maven.apache.org/maven2) -> [Help 2]
[ERROR] Unknown packaging: atlassian-plugin @ line 21, column 16
[ERROR] Non-resolvable import POM: Could not find artifact com.atlassian.bitbucket.server:bitbucket-parent:pom:4.11.0 in central (https://repo.maven.apache.org/maven2) @ line 32, column 25 -> [Help 3]
and here is my pom.xml:
<packaging>atlassian-plugin</packaging>
<properties>
<bitbucket.version>4.11.0</bitbucket.version>
<bitbucket.data.version>4.11.0</bitbucket.data.version>
<amps.version>6.2.3</amps.version>
<plugin.testrunner.version>1.1.1</plugin.testrunner.version>
</properties>
<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>
<dependencies>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-spi</artifactId>
<scope>provided</scope>
</dependency>
<!--<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-page-objects</artifactId>
<scope>provided</scope>
</dependency>-->
</dependencies>
<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>${bitbucket.version}</version>
<dataVersion>${bitbucket.data.version}</dataVersion>
</product>
</products>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
I'm looking forward to your reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nevermind. I use 'atlas-mvn eclipse:eclipse', and the problem solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
:-)
For people not on Eclipse, the trick is to tell your IDE to use the version of Maven that comes with the Atlassian SDK. In my own environment I had to tell my IntelliJ to use a different MAVEN_HOME.
The "atlas-mvn -v" command helps identify the exact "MAVEN_HOME" you need to use:
atlas-mvn -v
Maven home: /usr/share/atlassian-plugin-sdk-6.3.6/apache-maven-3.2.1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much, Sylvie! I am done developing my first Bitbucket plugin and deployed it to production :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Julius Davies _bit-booster_com_: thanks very much! I was looking for this for ages!! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Change the version to 4.11.0 and try. The artifact version is 4.11.0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI, Jobin, thank you for the reply. This time it was successful. But I got fatal error when try to access the link http://C02G7417DRJM.local:7990/bitbucket
The following problem occurred, which prevents Atlassian Bitbucket from starting:
My atlas-version gives the following:
ATLAS Version: 6.2.4
ATLAS Home: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec
ATLAS Scripts: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/bin
ATLAS Maven Home: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1
AMPS Version: 6.2.3
--------
Executing: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1/bin/mvn --version -gs /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1/conf/settings.xml
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00)
Maven home: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"
Is the version too new to support bitbucket 4.11.0?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SDK version shouldn't cause problem with the Bitbucket version. Maybe you are running into this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm still encountering the same fatal error after changing all the files inside log to be 776. The log has been updated, so looks like permission is not the issue. In the log, the following root causes are listed as why the application cannot start. The question is how do i fix it?
2018-06-27 07:41:43,633 ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdUserDao' defined in class path resource [crowd-spi-context.xml]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'projectDao' defined in URL [jar:file:/Users/vzhang/is-admin-merge-check/amps-standalone/target/container/tomcat8x/cargo-bitbucket-home/webapps/bitbucket/WEB-INF/lib/bitbucket-dao-impl-4.11.0.jar!/com/atlassian/stash/internal/project/HibernateProjectDao.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'projectDao' defined in URL [jar:file:/Users/vzhang/is-admin-merge-check/amps-standalone/target/container/tomcat8x/cargo-bitbucket-home/webapps/bitbucket/WEB-INF/lib/bitbucket-dao-impl-4.11.0.jar!/com/atlassian/stash/internal/project/HibernateProjectDao.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity; nested exception is org.springframework.beans.factory.BeanCreationException: Er
ror creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception i
s org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested ex
ception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[ConstructorResolver.class:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[AbstractApplicationContext.class:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[AbstractApplicationContext.class:4.3.2.RELEASE]
at javax.servlet.GenericServlet.init(GenericServlet.java:158) [servlet-api.jar:3.1.FR]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
... 18 frames trimmed
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'projectDao' defined in URL [jar:file:/Users/vzhang/is-admin-merge-check/amps-standalone/target/container/tomcat8x/cargo-bitbucket-home/webapps/bitbucket/WEB-INF/lib/bitbucket-dao-impl-4.11.0.jar!/com/atlassian/stash/internal/project/HibernateProjectDao.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity
... 6 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) ~[BeanDefinitionValueResolver.class:4.3.2.RELEASE]
... 5 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[AbstractAutowireCapableBeanFactory.class:4.3.2.RELEASE]
... 5 common frames omitted
Caused by: org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1335) ~[Configuration.class:4.3.11.Final]
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:175) ~[SchemaValidator.class:4.3.11.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:525) ~[SessionFactoryImpl.class:4.3.11.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) ~[Configuration.class:4.3.11.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1930) ~[Configuration.class:4.3.11.Final]
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372) ~[LocalSessionFactoryBuilder.class:4.3.2.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454) ~[LocalSessionFactoryBean.class:4.3.2.RELEASE]
at com.atlassian.stash.internal.hibernate.ExtendedLocalSessionFactoryBean.buildSessionFactory(ExtendedLocalSessionFactoryBean.java:99) ~[ExtendedLocalSessionFactoryBean.class:na]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439) ~[LocalSessionFactoryBean.class:4.3.2.RELEASE]
... 5 common frames omitted
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.