Hi folks
I’m writing a pre-receive hook for Bitbucket Data Center 8.18.
The add-on builds successfully, but the Soy template never gets compiled to JS, so the settings form cannot be rendered in Bitbucket (Unable to render configuration form for External API Branch Hook)
1) Environment
Component | Version |
---|---|
Bitbucket Data Center | 8.18.0 |
Atlassian SDK | 8.2.7 |
Apache Maven | 3.9.9 (exposed via ATLAS_MVN ; atlas-version shows Maven home = 3.9.9) |
Java | 11 |
bitbucket-maven-plugin (AMPS) |
8.6.0 |
atlassian-webresource-maven-plugin |
4.2.9-bitbucket1 |
Repository URL | https://packages.atlassian.com/maven/public/ |
OS | Windows 10 |
2) pom.xml
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>bitbucket-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>8.18.0</productVersion>
<enableQuickReload>true</enableQuickReload>
<compressResources>false</compressResources>
<products>
<product>
<id>bitbucket</id>
<instanceId>bitbucket</instanceId>
<version>${bitbucket.version}</version>
<dataVersion>${bitbucket.data.version}</dataVersion>
</product>
</products>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>com.gateops.bitbucket</Export-Package>
<!-- Add package import here -->
<Import-Package>org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
<!-- Ensure plugin is Spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
3)Project Tree
external-api-hook/
├─ src/
│ └─ main/
│ ├─ java/
│ │ └─ com/
│ │ └─ gateops/
│ │ └─ bitbucket/
│ │ ├─ hooks/
│ │ │ └─ ExternalApiPreReceiveHook.java
│ │ └─ validator/
│ │ └─ ExternalApiHookValidator.java
│ └─ resources/
│ ├─ css/
│ │ └─ external-api-hook.css
│ ├─ i18n/
│ │ └─ external-api-hook.properties
│ ├─ images/
│ │ ├─ pluginIcon.png
│ │ └─ pluginLogo.png
│ ├─ js/
│ │ └─ external-api-hook.js
│ ├─ templates/
│ │ └─ externalapi-config.soy
│ └─ atlassian-plugin.xml
├─ pom.xml
└─ target/ (build output)
4) atlassian-plugin.xml
<!-- Compile-time pre-compiled Soy templates & other static assets -->
<web-resource key="external-api-hook-resources" name="External API Hook Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.bitbucket.server.bitbucket-web-resources</dependency>
<resource type="download" name="externalapi-config.soy.js" location="templates/externalapi-config.soy.js"/>
<resource type="download" name="external-api-hook.css" location="css/external-api-hook.css"/>
<resource type="download" name="external-api-hook.js" location="js/external-api-hook.js"/>
<resource type="download" name="images/" location="images"/>
<context>bitbucket.hook.settings</context>
</web-resource>
<repository-hook key="externalApiHook"
name="External API Branch Hook"
class="com.gateops.bitbucket.hooks.ExternalApiPreReceiveHook">
<description>Call external API on push and reject if it returns an error.</description>
<config-form key="externalApiHook-config"
name="External API Hook Configuration">
<view>com.gateops.bitbucket.hooks.externalapi.formContents</view>
<resource name="external-api-hook-resources"/>
</config-form>
<validator>com.gateops.bitbucket.validator.ExternalApiHookValidator</validator>
</repository-hook>
Things I already tried
- Renamed the template to
external-api.soy
and updated plugin XML → still not compiled. - Downgraded AMPS to 8.4.1 (Maven 3.6.3) → runs but same “no Soy compile” behaviour.
- Upgraded WRM plugin to 4.4.4-bitbucket1 →
No plugin descriptor found at META-INF/maven/plugin.xml
. - Ran
atlas-mvn -X clean package
–generate-resources
step shows no Soy activity.
8 Expectation
externalapi-config.soy.js
should appear in the JAR so that Bitbucket can render the hook’s configuration form.
Any idea why WRM doesn’t kick in and emit the .soy.js
file?
Happy to provide a minimal repo if that helps. Thanks a lot!