Bitbucket Plugin Pre-Receive hook fails


On a clean machine, Windows 10. I downloaded and installed the JAVA JDK 1.8…0,131, Atlassian SDK 6.2.15. From this I did


I wish you would have tutorials for bitbucket plugins on the page for bitbucket I get redirected to stash plugin examples, it then says stash is now bitbucket - well the params to the tools need to be bitbucket - so the stash instructions dont work
Once the plug in has been created and half the planet downloaded. I do a


Then I edit the plugin and module as in the video (remove the International stuff, css, js etc). So I end up with an almost empty package, single class


import com.atlassian.bitbucket.hook.HookResponse;
import com.atlassian.bitbucket.hook.repository.PreReceiveRepositoryHook;
import com.atlassian.bitbucket.hook.repository.RepositoryHookContext;
import com.atlassian.bitbucket.repository.*;

import java.util.Collection;

public class AccBBPluginHook implements PreReceiveRepositoryHook

  • Disables deletion of branches

public boolean onReceive(RepositoryHookContext context, Collection refChanges, HookResponse hookResponse)
hookResponse.err().println(“MARCUS HELLO FROM HOOK LAND”);
return true;

I edit it to this after the wrong imports are added first by the create module script. Cant you tidy these up ? the module created doesn’t even compile.

I then run

atlas-debug product bitbucket

With Intellig 2017.2.5 I put break points on and set up a remote debug on 5005 with all other defaults.

I get a connection in IntelliJ, and the bitbucket service is running in browser, and I can see my plugin is enabled.

But the hook does not get hit, and no breakpoint. The atlassian-plugin.xml has the hook set up

The Acc BB Plugin Hook Plugin So in the folder I have the plugin xml, the pom, a class, and a meta-inf.spring meta folder.

Any ideas on why the BP is not hit but the IntelliJ session is connected ? And any plans to fix the create plugin ?

My atlas-version prints this out BTW

ATLAS Version: 6.2.15
ATLAS Home: C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.15
ATLAS Scripts: C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.15\bin
ATLAS Maven Home: C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.15\apache-maven-3.2.1
AMPS Version: 6.2.11

Executing: “C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.15\apache-maven-3.2.1\bin\mvn.bat” --version -gs C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.15\apache-maven-3.2.1/conf/settings.xml
Java HotSpot™ 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: C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.15\apache-maven-3.2.1
Java version: 1.8.0_152, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_152\jre
Default locale: en_US, platform encoding: Cp1252
OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “dos”

My Pom.xml

<?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mintel.nsgps accPlugin 1.0.0-SNAPSHOT Example Company accPlugin This is the plugin for Atlassian Bitbucket Server. atlassian-plugin com.atlassian.bitbucket.server bitbucket-parent ${bitbucket.version} pom import com.atlassian.sal sal-api provided com.atlassian.bitbucket.server bitbucket-api provided com.atlassian.bitbucket.server bitbucket-spi provided com.atlassian.bitbucket.server bitbucket-page-objects provided javax.servlet javax.servlet-api provided junit junit 4.10 test commons-lang commons-lang 2.6 provided com.atlassian.plugin atlassian-spring-scanner-annotation ${atlassian.spring.scanner.version} compile com.atlassian.plugin atlassian-spring-scanner-runtime ${atlassian.spring.scanner.version} runtime javax.inject javax.inject 1 provided com.atlassian.plugins atlassian-plugins-osgi-testrunner ${plugin.testrunner.version} test jsr311-api 1.1.1 provided gson 2.2.2-atlassian-1 org.mockito mockito-all 1.8.5 test com.atlassian.maven.plugins bitbucket-maven-plugin ${amps.version} true bitbucket bitbucket ${bitbucket.version} ${} ${atlassian.plugin.key}, org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", * * com.atlassian.plugin atlassian-spring-scanner-maven-plugin ${atlassian.spring.scanner.version} atlassian-spring-scanner process-classes com.atlassian.plugin atlassian-spring-scanner-external-jar false 4.9.1 4.9.1 6.2.11 1.2.3 1.2.13 ${project.groupId}.${project.artifactId} 1.8 1.8

Hi @marcusobrien,

First off: thanks for the feedback around the Bitbucket documentation and examples, we are aware of the problem and are currently working on improving it all (cc @mpaisley)

Quick basic question: did you activate your hook in your repository?
When I wrote a pre-receive hook I also forgot that little step at first.

Did you check the Bitbucket Server log file for your message?
It might still be firing but for some reason your breakpoint might not be triggered.

On first glance, I don’t see any problem with your code.