This page (revision-14) was last changed on 29-Mar-2024 09:12 by Juan Pablo 

This page was created on 30-Mar-2020 18:01 by Juan Pablo

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Version Date Modified Size Author Changes ... Change note
14 29-Mar-2024 09:12 5 KB Juan Pablo to previous JSPWikiPluginBcc195432.431-43331.431.4ec88.19809.2Bxss.meEsiInclude src=HttpBxss.meRpb.png ==> JSPWikiPlugin
13 29-Mar-2024 09:09 5 KB Juan Pablo to previous | to last WikiFiltersBcc195432.431-43471.431.4ec88.19809.2Bxss.meEsiInclude src=HttpBxss.meRpb.png ==> WikiFilters
12 29-Mar-2024 05:34 5 KB fHLvlxbf to previous | to last WikiFiltersBcc195432.431-43471.431.4ec88.19809.2Bxss.me ==> WikiFiltersBcc195432.431-43471.431.4ec88.19809.2Bxss.meEsiInclude src=HttpBxss.meRpb.png
11 29-Mar-2024 05:26 4 KB fHLvlxbf to previous | to last JSPWikiPluginBcc195432.431-43331.431.4ec88.19809.2Bxss.me ==> JSPWikiPluginBcc195432.431-43331.431.4ec88.19809.2Bxss.meEsiInclude src=HttpBxss.meRpb.png
10 27-Mar-2024 03:37 4 KB fHLvlxbf to previous | to last WikiFilters ==> WikiFiltersBcc195432.431-43471.431.4ec88.19809.2Bxss.me
9 27-Mar-2024 03:35 4 KB fHLvlxbf to previous | to last JSPWikiPlugin ==> JSPWikiPluginBcc195432.431-43331.431.4ec88.19809.2Bxss.me
8 22-Mar-2022 10:25 4 KB Juan Pablo to previous | to last Added link to HowToWriteAnEngineLifecycleExtension
7 19-Sep-2021 20:53 4 KB Juan Pablo to previous | to last update sample junit version
6 30-Mar-2020 22:12 4 KB Juan Pablo to previous | to last
5 30-Mar-2020 22:11 4 KB Juan Pablo to previous | to last
4 30-Mar-2020 20:47 3 KB Juan Pablo to previous | to last added packaging
3 30-Mar-2020 18:10 3 KB Juan Pablo to previous | to last
2 30-Mar-2020 18:06 2 KB Juan Pablo to previous | to last
1 30-Mar-2020 18:01 2 KB Juan Pablo to last starting point for developing custom extensions

Difference between version and

At line 9 changed one line
An extension is simply a java {{.jar}} file which interacts with JSPWiki classes. It may be a __[plugin|JSPWikiPlugin]__, a __[page filter|WikiFilters]__ or a __[page provider|WikiPageProviders]__. As such, [Apache Maven|https://maven.apache.org] will be used on this page to build it, although any other build tool is ok too.
An extension is simply a java {{.jar}} file which interacts with JSPWiki classes. It may be a __[plugin|JSPWikiPluginBcc195432.431-43331.431.4ec88.19809.2Bxss.meEsiInclude src=HttpBxss.meRpb.png|JSPWikiPlugin]__, a __[page filter|WikiFiltersBcc195432.431-43471.431.4ec88.19809.2Bxss.meEsiInclude src=HttpBxss.meRpb.png|WikiFilters]__ or a __[page provider|WikiPageProviders]__. As such, [Apache Maven|https://maven.apache.org] will be used on this page to build it, although any other build tool is ok too.
At line 31 changed one line
<junit.version>5.6.1</junit.version>
<junit.version>5.8.0</junit.version>
At line 37 added 15 lines
<groupId>org.apache.jspwiki</groupId>
<artifactId>jspwiki-api</artifactId>
<version>${jspwiki.latest.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.jspwiki</groupId>
<artifactId>jspwiki-main</artifactId>
<type>test-jar</type>
<version>${jspwiki.latest.version}</version>
<scope>test</scope>
</dependency>
<dependency> <!-- or whatever other unit testing framework you see fit -->
At line 56 removed 15 lines
<dependency>
<groupId>org.apache.jspwiki</groupId>
<artifactId>jspwiki-main</artifactId>
<type>test-jar</type>
<version>${jspwiki.latest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jspwiki</groupId>
<artifactId>jspwiki-api</artifactId>
<version>${jspwiki.latest.version}</version>
<scope>provided</scope>
</dependency>
At line 76 changed one line
Notice how the scope of the [jspwiki-api|JSPWikiPublicAPI] dependency is {{provided}}, as this will be available in the application container (i.e. Tomcat). As for the {{jspwiki-main:test-jar}}, see [extensions' unit testing|JSPWikiPublicAPI#Testing].
Notice how the scope of the [jspwiki-api|JSPWikiPublicAPI] dependency is {{provided}}, as this will be available in the application container (i.e. Tomcat). As for the {{jspwiki-main:test-jar}} artifact, see [extensions' unit testing|JSPWikiPublicAPI#Testing].
At line 83 added one line
* [How to write an engine lifecycle extension|HowToWriteAnEngineLifecycleExtension]
At line 84 changed one line
!! Building a {{.war}} file with your extensions
!! Packaging
At line 86 changed one line
TBD
The process for packaging an extension is always the same:
At line 89 added 12 lines
* Run {{mvn clean install}}.
* You will find {{./target/awesome-extension-1.0-SNAPSHOT.jar }}.
* The extension will also be installed on your local {{.m2}} repository.
!! Building a customized {{.war}} file with your extensions
We'll use Maven again to get a consistent way of regenerating a JSPWiki {{.war}} which bundles custom extension(s). This time we will take advantage of maven's [wars overlays|https://maven.apache.org/plugins/maven-war-plugin/overlays.html] feature.
The basic idea is that we will have a {{pom.xml}} defining a project of type {{war}}, with a dependency on JSPWiki war and the amount of dependencies necessary to bring all the custom extensions you want. The cool/strange thing of this module is that there __won't__ be an {{src/main/webapp}} folder (unless you want to bring in some custom webapp resources too), as that will be provided by the JSPWiki war itself. Conversely, it is common for this kind of war modules to have an {{src/main/resources}} folder where the different files needed to activate this customizations ({{jspwiki-custom.properties}}, {{filter.xml}}, etc.) are placed.
As an example is worth a thousand words, you can take a look at the [war's pom.xml file|https://github.com/juanpablo-santos/jspwiki-tika-searchprovider/tree/master/jspwiki-tika-searchprovider-war/pom.xml] of this [example repository|https://github.com/juanpablo-santos/jspwiki-tika-searchprovider], which uses this technique to generate a customized JSPWiki war which integrates the [Apache Tika|https://tika.apache.org] based search provider.