WebLab Archetype Plugin

From WebLab Wiki

Jump to: navigation, search

Contents

Goal of the plugin

This plugin allows to generate WebLab service(s) stub(s) with all resources necessary for their execution. According to usage, it uses several archetypes that should not be called outside of this plugin.

Maven configuration

First of all, if it's not done, you have to install Maven (see maven documentation[1]). Then, you have to modifying the file <maven directory>/conf/settings.xml. If you already have a profile in your settings, then you just have to add this in the repositories markup :

[...]
<repositories>
[...]
    <repository>
        <id>ow2</id>
        <url>http://maven.ow2.org/maven2</url>
        <name>ow2</name>
    </repository>
    <repository>
        <id>ow2-snapshot</id>
        <url>http://maven.ow2.org/maven2-snapshot/</url>
        <name>ow2-snapshot</name>
    </repository> 
</repositories>
[...]

If not, you have to create a new profile in the profiles markup, and activate the profile in the settings markup, such as below :

<settings ...>
[...]
    <profiles>
        <profile>
            <id>AnyIDYouWant</id> <!-- must be the same as below -->
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>ow2</id>
                    <url>http://maven.ow2.org/maven2</url>
                    <name>ow2</name>
                </repository>
                <repository>
                    <id>ow2-snapshot</id>
                    <url>http://maven.ow2.org/maven2-snapshot/</url>
                    <name>ow2-snapshot</name>
                </repository> 
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>ow2</id>
                    <url>http://maven.ow2.org/maven2</url>
                    <name>ow2</name>
                </pluginRepository>
                <pluginRepository>
                    <id>ow2-snapshot</id>
                    <url>http://maven.ow2.org/maven2-snapshot/</url>
                    <name>ow2-snapshot</name>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>AnyIDYouWant</activeProfile> <!-- must be the same as above -->
    </activeProfiles>
</settings>

To invoke the plugin by its prefix weblab you have to add group identifier (i.e.: mvn weblab:generate ...):

<settings ...>
[...]
    <pluginGroups>
    [...]
        <pluginGroup>org.ow2.weblab.tools.maven</pluginGroup>
    </pluginGroups>
</settings>

With this configuration, Maven can retrieve libraries needed to the next steps.

Usage

Calls to the plugin is as follows:

mvn org.ow2.weblab.tools.maven:weblab-archetype-plugin:generate

Some parameters are compulsory:

  • -DserviceName: The name of service(s) classes. Concatenated with the interface name whether more than two WebLab interfaces are invoking;
  • -DwebLabInterface: A comma separated list of interfaces to be implemented. It can either be their number or their simple name;
  • -DartifactId: The name of the project and actifactId to be used in generated POM.


Some other are optional:

  • -DgroupId: The groupId to be used in the generated pom. Default value is org.ow2.weblab.service;
  • -Dpackage: The package to be used for generated classes. Default value is groupId;
  • -Dversion: The version to be used in the generated pom. Default value is 1.0-SNAPSHOT.


WebLab Web service(s) implement several interfaces which can be:

  • 1 <=> analyser
  • 2 <=> configurable
  • 3 <=> indexer
  • 4 <=> queuemanager
  • 5 <=> reportprovider, deprecated since WebLab 1.2.5, please consider using an Auditable combine with an Indexer
  • 6 <=> resourcecontainer
  • 7 <=> searcher
  • 8 <=> sourcereader, deprecated since WebLab 1.2.5, please consider using a QueueManager
  • 9 <=> trainable
  • 10 <=> auditable
  • 11 <=> cleanable


Example command line

Invoke the plugin with the required parameters can be for instance:

mvn org.ow2.weblab.tools.maven:weblab-archetype-plugin:generate
-DserviceName=Service
-DwebLabInterface=analyser
-DartifactId=Test

The plugin will then generate the following folders and files:

├── pom.xml
└── src
    ├── main
    │   ├── java
    │   │   └── org
    │   │       └── ow2
    │   │           └── weblab
    │   │               └── service
    │   │                   └── Service.java
    │   └── webapp
    │       └── WEB-INF
    │           ├── cxf-servlet.xml
    │           └── web.xml
    └── test
        ├── java
        │   └── org
        │       └── ow2
        │           └── weblab
        │               └── service
        │                   └── ServiceTest.java
        └── resources
            ├── corpus
            │   └── resourceTest.xml
            └── log4j.properties

Invoke with prefix

Whether the plugin group identifier is add in file <maven directory>/conf/settings.xml, so the command line maybe simplify as follows:

mvn weblab:generate ...

Display documentation

To display help with the plugin, you can used the specific goal:

mvn org.ow2.weblab.tools.maven:weblab-archetype-plugin:help

Extra documentation

For more information, follow the link hereafter:

  • Development of a new service:

http://weblab-project.org/index.php?title=Development_of_a_new_service

  • Service interfaces:

http://weblab-project.org/index.php?title=WebLab_services_interfaces


  1. http://maven.apache.org/
Personal tools