Com.atlassian.plugin:atlassian-spring-scanner-maven-plugin:2.1.3 not found

I am posting one of my posts from Atlassian community. I think I could help a lot of people…

Below was my question/problem:

I used atlas-create-bitbucket-plugin command and was able to generate the skeleton project. Then I opened this project using Intellij Idea. Now there are red lines everywhere. Nothing gets resolved.

pom says
com.atlassian.plugin:atlassian-spring-scanner-maven-plugin:2.1.3 not found

Build messages say:
Error:(3, 61) java: package com.atlassian.plugin.spring.scanner.annotation.export does not exist
Error:(4, 62) java: package com.atlassian.plugin.spring.scanner.annotation.imports does not exist
Error:(5, 29) java: package com.atlassian.sal.api does not exist
Error:(11, 2) java: cannot find symbol
symbol: class ExportAsService
Error:(16, 19) java: cannot find symbol
symbol: class ApplicationProperties
location: class com.myplugins.invoker.impl.MyPluginComponentImpl
Error:(19, 40) java: cannot find symbol
symbol: class ApplicationProperties
location: class com.myplugins.invoker.impl.MyPluginComponentImpl

I followed online guides and did everything right. I don’t know what is wrong here.. Any ideas?

And below is how I solved it:

I was facing these problems:

Inside Terminal:
I do “mvn install” in the plugin directory and it says “Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile ….. package com.atlassian.bitbucket.repository.hook does not exist”.

Then, I installed the latest version of maven, changed M2_HOME and tried “mvn install” in the root directory. Same problem.. (still using the settings for the SDK’s maven installation)

Inside IDEA:
My class says “cannot resolve symbol RepositoryHookContext”.

I think my problem is with telling IDEA to use the SDK. I tried to add the SDK folder during project import but IDEA says it is not a valid path. Isn’t it “/usr/local/Cellar/atlassian-plugin-sdk/6.3.4”?

It is very frustrating not being able to mvn install a plugin project out of the box you know..

Edit: I removed the import statement below from my class:
import com.atlassian.bitbucket.repository.hook.*;

Pre-mentioned errors are gone..

Now “mvn install” says: {groupid.artifactid.classname} is not abstract and does not override abstract method validate(com.atlassian.bitbucket.setting.Settings,com.atlassian.bitbucket.setting.SettingsValidationErrors,com.atlassian.bitbucket.scope.Scope) in com.atlassian.bitbucket.setting.SettingsValidator

But actually it does:

One thing to mention

Here IDEA says both AsyncPostReceiveRepositoryHook and RepositorySettingsValidator are deprecated and validate method above says “Overrides deprecated method in ‘com.atlassian.bitbucket.setting.RepositorySettingsValidator'”

Edit:I changed the RepositorySettingsValidator to SettingsValidator as below:

Also changed the validate method accordingly:

Now all works.

Hope this helps.
Good Luck,