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

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? 

0 vote
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! 

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
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
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

125 views 4 9
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