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

Jamie Paterson December 21, 2017

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

0 votes
Jamie Paterson December 21, 2017

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 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

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2017

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

Jamie Paterson December 21, 2017

Thanks for the heads-up! 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2017

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

Jamie Paterson December 21, 2017

Will do, appreciate the support! 

0 votes
Jamie Paterson December 21, 2017

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? 

Suggest an answer

Log in or Sign up to answer