Why can't Atlassian SDK find getDisplayName() method/symbol from ApplicationProperties?

Hi,

 

I've imported com.atlassian.sal.api.ApplicationProperties into MyPluginComponentImpl.java where getDisplayName() method is called on an ApplicationProperty instance/object within public String getName() method, however when i run atlas-run within the same directory as the pom.xml file, the command prompt displays an error: "[ERROR] .../myGadget/jira-gadget-tutorial-plugin/src/main/java/com/atlassian/plugins/tutorial/impl/MyPluginComponentImpl.java:[28, 70] cannot find symbol 

symbol: method getDisplayName()

location: variable applicationProperties of type com.atlassian.sal.api.ApplicationProperties"

 

I've included the <dependency> "com.atlassian.sal" amongst others within the pom.xml file (<version> 2.1.beta4), I've also included the<dependency> "org.codehaus.cargo" (<version> 1.4.4) and ran the command "atlas-mvn eclipse:eclipse" but still no luck! 

 

However, i've used this same implementation of MyPluginComponentImpl.java for another JIRA plugin, which uses the same package (i.e. com.atlassian.sal.api.ApplicationProperties) and calls the same method getDisplayName(), but this seems to work no problem, when i run atlas-run within plugin root/home directory. 

Can anyone explain whats going on here? is it a version/compatibility issue?  

3 answers

This widget could not be displayed.

I Figured this out, it was the version i was using for <dependency> com.atlassian.sal, changed this from 2.1.beta4 to 2.7.0


<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.7.0</version>
<scope>provided</scope>
</dependency>

 

Now i get another error further within the build process, which states: "atlassian-plugin.xml contains a definition of a component-import. This is not allowed when Atlassian-Plugin-Key is set." Any ideas what's wrong here? 

This widget could not be displayed.
Alexey Matveev Community Champion Dec 21, 2017

You should delete all component-import tags in atlassian-plugin.xml and import all components through spring-scanner.

Thanks for the heads-up! 

Alexey Matveev Community Champion Dec 21, 2017

If you have any other questions regarding the error, just ask.

Will do, appreciate the support! 

This widget could not be displayed.

Can you just comment out (omit) the <component-import> tag section within the atlassian-plugin.xml file and leave it at that or do you have to use spring-scanner as the alternative, and is spring-scanner declared within the same xml file or is this declared within one of the java files for the plugin/gadget? 

Alexey Matveev Community Champion Dec 21, 2017

Could you provide your pom.xml? Usually spring-scanner is included there. There must be something like this

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>

Then you need to find places in your project where the components are used and see if it is injected the proper way. I would need to see some of your code

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

124 views 2 0
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