...
Now that XperienCentral is installed, it’s time to build your first plugin. The first plugin will contain one component: the helloWorld element component. After building and deploying this plugin, there will be a new element in XperienCentral. If that element is placed on a page, the text “Hello World!” will be displayed on the web page.
Note |
---|
To generate a plugin containing a sidebar widget, see the topic Widget Archetype. |
Maven
XperienCentral requires Maven 3.36..x. It’s very easy to check which version you are currently using: open a command prompt and type:
...
To download the latest version of Maven 3.36.x, go to the website: http://maven.apache.org/download.html.
...
- Create a folder on your computer in which you will start working on your helloWorld element (
C:\GX\helloWorldWCBshelloWorld
, for example). - Open a command prompt.
- Navigate to the folder in which the element should will be created (
C:\GX\helloWorldWCBshelloWorld)
. Execute the command (replace the
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.1037.0, for example)):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-element-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldelement -Dclassprefix=HelloWorld -s <xperiencentral-root>\settings.xml
A new subfolder called "helloworldelement
" is now present.
Building and Deploying the Plugin
...
- Open a command prompt window.
- Go to the folder
C:\GX\helloWorldWCBshelloWorld\helloworldelement
. - Execute the command:
mvn -s ..\..\XperienCentral
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldelement-1.0.0.jar
from the target folder toC:\GX\XperienCentral\
.<xperiencentral-root>
\work\deploy - The element is now available in XperienCentral. To prevent everybody from being able to use it right away, the element has to be activated first (this can be done through the
Configuration > Channel configuration > Functionalities menu). After activation, the element is available in the menu.
...
Creating a Plugin with a Panel Component
...
- Open a command prompt.
- Navigate to the folder in which you already created your helloworldelement (
C:\GX\helloWorldWCBshelloWorld
, for example). - Execute the command (replace <XperienCentral Version> with the version number of XperienCentral that you’re building against, (10.10.0, for example):
mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-panel-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldpanel -Dclassprefix=HelloWorld -s ..\XperienCentral
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldpanel
" is now present.
Building and Deploying the Panel
...
- Open a command prompt.
- Navigate to the folder where the helloworldpanel was created (
C:\GX\helloWorldWCBs
, for example).<xperiencentral-root>
\helloWorld\helloworldpanel - Execute the command:
mvn -s ..\..\XperienCentral
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldpanel-1.0.0.jar
from the target folder toC:\GX\XperienCentral\
.<xperiencentral-root>
\work\deploy
Press F5 to refresh XperienCentral - The panel is now available in XperienCentral in the Configuration menu.
...
...
Creating a Plugin with a Media Item Component
In XperienCentral, the Content Repository can be filled with articles and multimedia items. These objects have a predefined set of metadata. If you need additional metadata for specific types of objects in the Content Repository, a new media item can be created. For example, vacancies have an additional selection list of predefined locations in the metadata.
Note |
---|
In XperienCentral, the terms "media item" and "content item" are synonymous. For reasons of backward compatability with earlier versions of GX WebManager 9.x, these terms are used interchangeably throughout our documentation. |
Creating the helloWorld Media Item
...
- Open a command prompt.
- Navigate to the folder in which you already created your helloworldelement and helloworldpanel (
C:\GX\helloWorldWCBshelloWorld
). - Execute the command (replace
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.10.0, for example):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-mediaitem-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldmediaitem -Dclassprefix=HelloWorld -s ..\XperienCentral
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldmediaitem" is now present.
...
- Open a command prompt.
- Navigate to the folder
C:\GX\helloWorldWCBshelloWorld\helloworldmediaitem
. - Execute the command:
mvn -s ..\..\XperienCentral\
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldmediaitem-1.0.0.jar
from the target folder toC:\GX\XperienCentral
.<xperiencentral-root>
\work\deploy - Press F5 to refresh XperienCentral - The mediaItem component is now available in XperienCentral.
...
Note |
---|
If you create a custom download media item that you want to be downloadable directly from a Content Overview and/or Dynamic Content Overview element, the custom |
...
Creating a Plugin with a Page Metadata Component
...
- Open a command prompt.
- Navigate to the folder in which you already created your helloworldelement (
C:\GX\helloWorldWCBshelloWorld
). - Execute the command (replace
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.6.0, for example):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-pagemetadata-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldpagemetadata -Dclassprefix=HelloWorld -s ..\XperienCentral
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldpagemetadata" is now present.
...
- Open a command prompt.
- Navigate to the folder
C:\GX\helloWorldWCBshelloWorld\helloworldpagemetadata
. - Execute the command:
mvn -s ..\..\XperienCentral\
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldpagemetadata-1.0.0.jar
from the "target" folder toC:\GX\XperienCentral
.<xperiencentral-root>
\work\deploy
Press F5 to refresh XperienCentral - The Page Metadata component is now available in XperienCentral. For each page it is now possible to enter a value for the new properties as defined in the page metadata component.
...
...
Creating a Plugin with a Presentation Component
...
- Open a Command prompt.
- Navigate to the folder in which you already created your helloworldelement (
C:\GX\helloWorldWCBshelloWorld
). - Execute the command (replace
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.10.0, for example):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-presentation-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldpresentation -Dclassprefix=HelloWorld -s ..\XperienCentral
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldpresentation" is now present.
...
- Open a command prompt.
- Navigate to the folder
C:\GX\helloWorldWCBshelloWorld\helloworldpresentation
. - Execute the command:
mvn -s ..\..\XperienCentral\
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldpresentation-1.0.0.jar
from the ‘target’ folder toC:\GX\XperienCentral
.<xperiencentral-root>
\work\deploy
The style is now available in XperienCentral.
...
Creating a Plugin with a Service Component
...
- Open a Command prompt.
- Navigate to the folder in which you already created your helloworldelement (
C:\GX\helloWorldWCBshelloWorld
). - Execute the command (replace
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.6.0, for example):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-service-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldservice -Dclassprefix=HelloWorld -s ..\XperienCentral\
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldservice" is now present.
...
- Open a Command prompt.
- Navigate to the folder
C:\GX\helloWorldWCBshelloWorld\helloworldservice
. - Execute the command:
mvn -s ..\..\XperienCentral\
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldservice-1.0.0.jar
from the ‘target’ folder toC:\GX\XperienCentral
folder.<xperiencentral-root>
\work\deploy
The service is now available to other plugins in XperienCentral.
...
Creating a Plugin with a Servlet Component
...
- Open a command prompt.
- Navigate to the folder in which you already created your helloworldelement (
C:\GX\
helloWorldWCBshelloWorld
). - Execute the command (replace
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.6.0, for example):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-servlet-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldservlet -Dclassprefix=HelloWorld -s ..\XperienCentral\
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldservlet" is now present.
...
- Open a command prompt.
- Navigate to the folder
C:\GX\helloWorldWCBshelloWorld\helloworldservlet
. - Execute the command:
mvn -s ..\..\XperienCentral
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldservlet-1.0.0.jar
from the ‘target’ folder toC:\GX\XperienCentral\
.<xperiencentral-root>
\work\deploy
The servlet is now available to other plugins in XperienCentral. To test the proper working of the servlet, open a browser window and navigate to either:
...
http://<hostname>:<portnumber>/<context>/helloworldservlet.servlet
...
helloworldservlet - Hello World!
Init parameter: ‘key’ = ‘value’
it should display:
helloworldservlet - Hello World!
Init parameter: ‘key’ = ‘value’
...
Creating a Plugin with a Sidebar Widget
You can add new sidebar (DOJO) widgets to XperienCentral. This archetype will give you a small working sidebar widget example which will respond to the current context and show the title of the content item (Page, Page Section, Media Item) that is being editted and enable the editor to change the url title.
Creating the helloWorld Sidebar Widget
To create a plugin that will add a new presentation style to XperienCentral, perform the following steps:
- Open a Command prompt.
- Navigate to the folder in which you already created your helloworldelement (
C:\GX\helloWorld
). - Execute the command (replace
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.10.0, for example):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-sidebarwidget-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldsidebarwidget -Dclassprefix=HelloWorld -s
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldsidebarwidget" is now present.
Building and Deploying the Sidebar Widget Component
In order to build and deploy the plugin, perform the following steps:
- Open a command prompt.
- Navigate to the folder
C:\GX\helloWorld\helloworldsidebarwidget
. - Execute the command:
mvn -s
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldpresentation-1.0.0.jar
from thetarget
folder to
.<xperiencentral-root>
\work\deploy
The widget is now available in XperienCentral (refresh the browser to load the new component in the JavaScript client framework).
...
Creating a Plugin with a Presentation Component
Each XperienCentral page is connected to a presentation (appearance). A presentation is connected to its own JSP template, used by XperienCentral to generate the HTML of the page. With this component it is possible to create new presentation. Presentations can have small differences (like another lead color or logo) or can be completely different.
Creating the helloWorld Presentation
To create a plugin that will add a new presentation style to XperienCentral, perform the following steps:
- Open a Command prompt.
- Navigate to the folder in which you already created your helloworldelement (
C:\GX\helloWorld
). - Execute the command (replace
<XperienCentral Version>
with the version number of XperienCentral that you’re building against (10.10.0, for example):mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=nl.gx.webmanager.archetypes -DarchetypeArtifactId=webmanager-presentation-archetype -DarchetypeVersion=<XperienCentral Version> -DgroupId=com.gxwebmanager.helloworld -DartifactId=helloworldpresentation -Dclassprefix=HelloWorld -s
<xperiencentral-root>
\settings.xml
A new subfolder called "helloworldpresentation" is now present.
Building and Deploying the Presentation Component
In order to build and deploy the plugin, perform the following steps:
- Open a command prompt.
- Navigate to the folder
C:\GX\helloWorld\helloworldpresentation
. - Execute the command:
mvn -s
<xperiencentral-root>
\settings.xml clean package - Copy the file
helloworldpresentation-1.0.0.jar
from the ‘target’ folder to
.<xperiencentral-root>
\work\deploy
The style is now available in XperienCentral.
...
Troubleshooting
The Plugin Does not Compile
...
- Open the menu Window > Preferences > Java > Installed JREs.
- Ensure that a JDK version of Java is used in your JRE definition
- If the used JRE definition points to a JRE version of Java, then remove the reference to the JRE and create a new reference to the JDK.