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

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

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"

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...?

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

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

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,452 views 26 12
Join discussion

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