Unable to deploy plugin via plugin.xml

Post here questions and problems related to oXygen frameworks/document types.
DirkDubois
Posts: 22

Unable to deploy plugin via plugin.xml

Tue Jan 20, 2015 5:22 pm

Hello,

I want to develop a series of plugins for the XML Author IDE. I am following the project samples provided by the oxygen SDK, and trying to deploy one of the test projects. After setting up Maven in Eclipse, I was able to build the oxygen-sample-pluging-uppercase sample. Following the user guide http://www.oxygenxml.com/doc/ug-editor/ ... lugin.html which describes how to create the plugin.xml file, I placed the following files in a folder in the plugins folder of oxygen.

Oxygen
|->plugins
|-->uppercase
|--->plugin.xml
|---->lib
|----->oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT.jar
|----->oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT-plugin.jar

Where plugin.xml contains the following code,

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- The plugin.dtd file is located in the OXYGEN_INSATALL_DIR/plugins directory -->
<!DOCTYPE plugin SYSTEM "../plugin.dtd">

<plugin
    id="com.oxygenxml.plugin.UpperCase"
    name="UpperCase"
    description="Convert the selection to uppercase"
    version="1.0.0"
    vendor="SyncRO"
    class="myGroup.mySample.uppercase.UppercasePlugin"
    classLoaderType="preferReferencedResources">
    <runtime>
        <library name="lib/oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT.jar"/>
    </runtime>
    <extension type="selectionProcessor"
    class="myGroup.mySample.uppercase.UppercasePluginExtension"/>
</plugin>


When I restart oxygen and go to Help, Manage Add-ons, and select the plugin.xml file I get the following error:

Code: Select all

System ID: C:\Program Files\Oxygen XML Editor 16\plugins\uppercase\plugin.xml
Severity: error
Description: Invalid update site. Cause: cvc-elt.1.a: Cannot find the declaration of element 'plugin'.


As far as I can tell I have correctly followed the instructions from the user guide, what might be the issue? Thank you for all your help.

Sincerely,
Dirk Dubois
XML Programmer, Technical Writing
Matrox Imaging
alex_jitianu
Posts: 649

Re: Unable to deploy plugin via plugin.xml

Tue Jan 20, 2015 5:41 pm

Hi Dirk,

After building the project (using either mvn package or mvn install) the plugin is packed at target/oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT-plugin.jar. Unzip this archive in the plugins folder making sure not to create any additional folders. Basically the structure should look like the one you described:

Code: Select all

plugins
->oxygen-sample-plugin-uppercase-17.0-SNAPSHOT
-->lib
-->plugin.xml


One strange thing that I've noticed in your package is the existence of -plugin.jar file in the lib folder. If you follow the procedure above, is the plugin working? If not, please send the package on the support list for us to have a look at it.

Best regards,
Alex
DirkDubois
Posts: 22

Re: Unable to deploy plugin via plugin.xml

Tue Jan 20, 2015 5:53 pm

Thank you for the quick reply, I'm still confused as to what the file structure should look like. When I run Maven install two jar files are generated:
->oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT.jar
->oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT-plugin.jar

So if I have understood correctly, I unzip the oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT.jar and retrieve the two class files enclosed. Then I copy those files and the plugin.xml to Oxygen/plugins. The final result would look like this:

$\Oxygen XML Editor 16\plugins\plugin.xml
$\Oxygen XML Editor 16\plugins\lib\UppercasePlugin.class
$\Oxygen XML Editor 16\plugins\lib\UppercasePluginExtension.class

Is this correct? I'm a missing a folder for encapsulation? Also, if at the end of the day you need to install the class files not the *.jar then why build those at all. Finally, why does the plugin.xml file make reference to a jar file in the <library> element if we are not installing one?

Thanks for all your help.

Dirk
XML Programmer, Technical Writing
Matrox Imaging
DirkDubois
Posts: 22

Re: Unable to deploy plugin via plugin.xml

Tue Jan 20, 2015 9:08 pm

Hello Again,

It would seem I was unzipping the wrong JAR file. I need to unzip oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT-plugin.jar and not the oxygen-sample-plugin-uppercase-0.0.1-SNAPSHOT.jar. I now see that the first one is referenced by the plugin. Once I unzipped the *-plugin.jar I was able to see the plugin.xml and lib folder.

Once I restarted oxygen I could see that the plugin was correctly installed from the manage add-ons tab. However, I now do not see the Preferences menu in the editor as mentioned by the readme. Is there an option that must be enabled to see this menu?

Thanks for all your help.
Dirk
XML Programmer, Technical Writing
Matrox Imaging
DirkDubois
Posts: 22

Re: Unable to deploy plugin via plugin.xml

Tue Jan 20, 2015 9:10 pm

Sorry for spamming the forum.

The contextual menu only appears once some text is selected. I can now see it in the editor. My final question is what is the extension.xml file needed for? It was not mentioned in the documentation.
XML Programmer, Technical Writing
Matrox Imaging
alex_jitianu
Posts: 649

Re: Unable to deploy plugin via plugin.xml

Wed Jan 21, 2015 10:00 am

Hello Dirk,

I'm glad that you were successful in deploying the plugin! I agree that the two jars there are a bit confusing... The first one contains the compiled JAVA classes and the one with the plugin suffix is the actual package (contains all the required resources together with the compiled classes-the first jar). I will add a new issue to change the packaging type of the plugin to ZIP in hoping that it will make it stand out from the other one.

For now you can ignore the extension.xml file. It's useful if you intend to pack the framework as an add-on. We have also a procedure on How to Pack and Deploy an Add-on.

Best regards,
Alex

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 0 guests