How do I fix this? import showing error

import com.atlassian.webresource.api.assembler.PageBuilderService;
import org.springframework.beans.factory.annotation.Autowired;
While writing a plugin, I need to add these to imports. But the “webresource” and the “springframework” fieldds appear red and a pop up says " cannot resolve symbol. How can I fix this?

@nadav.dahan can you please provide us with more information.
Which product are you building an add-on for?
What platform? (Server, Cloud, Data Center?)
What you tried already?
Which errors are you getting and in which tools?

Currently, your question is impossible to answer without a lot of research and time.
None of which anybody here has in abundance.

Please be considerate of your fellow community member’s time.

@pvandevoorde
I’m trying to build an add-on for confluence. I’m using the Atlassian guide to build/create a macro for confluence.

https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/create-a-confluence-hello-world-macro
under Format the macro appearance using css - step10

And the final step states to but these imports among others in the java file, but once I do this my editor (IntelliJ) underlines “webresource” and “springframework” and shows me an error once I hover.
“Cannot resolve symbol”
Any advice? maybe the tutorial is out of date or needs to be checked

2 Likes

You’re missing some dependencies. Make sure your ide is importing the maven stuff properly.

If it’s still not working, you’ll probably need to add something like:


        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource-api</artifactId>
                <version>3.5.9</version>
                <scope>provided</scope>
        </dependency>

And for the spring piece:

<dependency>
     <groupId>org.springframework:spring-beans:jar</groupId>
    <artifactId>spring-beans</artifactId>
    <version>3.2.10.RELEASE</version>
    <scope>provided</scope>
</dependency>
3 Likes

I was struggling with the same error for 2 hours (new to java). Thanks for the solution. :slight_smile: