Unresolved XWikiDefaultPlugin symbol in the plugin

I’m following the Creating Plugins tutorial. And in the Write the plugin part it tells me to declare the plugin class:

public class HelloWorldPlugin extends XWikiDefaultPlugin {

}

So I did that, but it can’t resolve the XWikiDefaultPlugin symbol:
idea64_Vyta8ln9Wv

I’ve read through the tutorial, it doesn’t say where to get it and how to resolve it. How do I resolve the symbol?

I kept reading the wiki and since then read Creating XWiki Components guide, which does explain how to get the dependencies. With Maven. It does explain a bit how to get the dependencies for the plugin but not specifically. I also read the API Guide page, on which it says:

How to find a class
You can get the maven module where to find a Java class by using XWiki Nexus Search page. Put the complete class name and you will get all modules containing it. Nexus also allows you to see what’s in those artifacts and read the javadoc.

So I searched for XWikiDefaultPlugin on the Nexus Search page. It found it and recommended me this dependency:
chrome_uhDyDAHG5F

<dependency>
  <groupId>org.xwiki.platform</groupId>
  <artifactId>xwiki-platform-oldcore</artifactId>
  <version>14.9</version>
</dependency>

But when I add it to the pom file, it doesn’t work. It can’t find the dependency:
cmd_qJZpjfNbsf

D:\Projects\Tests\XWikiHelloWorldPlugin>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------< com.kulagin:XWikiExcelBatchImportApplication >------------
[INFO] Building XWiki Excel Batch Import Application 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.xwiki.platform:xwiki-platform-oldcore:jar:14.9 is missing, no dependency information available[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.166 s
[INFO] Finished at: 2022-11-13T16:30:30+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project XWikiExcelBatchImportApplication: Could not resolve dependencies for project com.kulagin:XWikiExcelBatchImportApplication:jar:1.0-SNAPSHOT: org.xwiki.platform:xwiki-platform-oldcore:jar:14.9 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Why do I want to make my own plugin and not a component? To be able to fix the broken Excel plugin, which also doesn’t build and doesn’t want to download the dependencies, check out this issue for details.

I’m hitting dead ends with broken things all over the place, unfortunately.

Sounds like you did not configure your Maven setting to look at XWiki Maven repository. You might want to take a look at Building XWiki from sources - XWiki.

2 Likes

Thanks. That worked and now I can build the plugin. Updated the Creating Plugins tutorial, so people can follow the tutorial from start to finish.