cannot find symbol class ChangesetsBetweenRequest

I am trying to get a list of changes between two commits using the HistoryService's getChangesetBetween() function: https://developer.atlassian.com/static/javadoc/stash/2.4.1/api/reference/com/atlassian/stash/history/HistoryService.html#getChangesetsBetween%28com.atlassian.stash.content.ChangesetsBetweenRequest,%20com.atlassian.stash.util.PageRequest%29

Following the example in the documentation, I am trying to create a ChagesetsBetweenRequest object, but am getting an error when I try to import it.

import com.atlassian.stash.content.ChangesetsBetweenRequest;

The error:

/home/ben/git/stash_plugin/stash-example-async-post-receive-config/src/main/java/com/mycompany/example/plugin/myhook/MyRepositoryHook.java:[9,34] cannot find symbol
symbol  : class ChangesetsBetweenRequest
location: package com.atlassian.stash.content

/home/ben/git/stash_plugin/stash-example-async-post-receive-config/src/main/java/com/mycompany/example/plugin/myhook/MyRepositoryHook.java:[10,59] package com.atlassian.stash.content.ChangesetsBetweenRequest does not exist

I've also tried importing all of com.atlassian.stash.content.*, but this does not help.

7 answers

1 accepted

This widget could not be displayed.

Hi Ben,

You should definitely be using the same version as your production instance for stash.version. The data version is just the initial data set and doesn't matter so much because we update the DB schema regardless (but it's probably just as easy to keep them the same).

Let me know if run into any more problems.

Cheers,

Charles

This widget could not be displayed.

By the way, I'm developing on a local development machine, not on our production server. I'm testing my plugin with the `atlas-run` command. Here is the output from `atlas-version` for context.

% atlas-version

ATLAS Version:    4.2.5
ATLAS Home:       /opt/atlassian/plugin-sdk
ATLAS Scripts:    /opt/atlassian/plugin-sdk/bin
ATLAS Maven Home: /opt/atlassian/plugin-sdk/apache-maven
--------
Executing: /opt/atlassian/plugin-sdk/apache-maven/bin/mvn --version -gs /opt/atlassian/plugin-sdk/apache-maven/conf/settings.xml
Apache Maven 2.1.0 (r755702; 2009-03-18 14:10:27-0500)
Java version: 1.6.0_45
Java home: /opt/sun-java6/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "3.10.10-1-arch" arch: "amd64" Family: "unix"

This widget could not be displayed.

I just noticed that at the bottom of the Stash pages it says version 2.2.0, but it seems the API documentation and the production server we are running are both 2.4.1.

I've tried specifying the version of stash with the following command (I also tried the same with `atlas-run-standalone`, but got errors when I tried to access the page.).

% atlas-clean
% atlas-run --product stash --version 2.4.1

This got the displayed stash version to be correct, but I am still hitting the same "cannot find symbol" error. Perhaps I need to also somehow specify the version of the API it should compile my code with...?

This widget could not be displayed.

Hi Ben,

Hmm. Any chance of sharing the plugin source? That will make it a little easier to figure out what is going wrong.

Cheers,

Charles

This widget could not be displayed.

Of course. Here is the java file: https://gist.github.com/BenBergman/57c2caefaf670193d0a7

This plugin is based on one of the Atlassian examples on bitbucket: https://bitbucket.org/atlassian/stash-example-async-post-receive-config

This widget could not be displayed.

Hi Ben,

Apologies, I should have been more specific. I'm actually more interested in the pom.xml, which I suspect is where the problem lies.

Charles

This widget could not be displayed.

Here it is: https://gist.github.com/BenBergman/af925808e9c03c36f00c

I noticed that at the end of the file there are two places where it states stash [data] version 2.2.0. I changed them both to 2.4.1 and things seem to be working better now. Let me know if I shouldn't have updated them both.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,214 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you