Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Getting the identifier

...

Let's assume that the identifier of The Warehouse plugin is warehouse.

Maven archetype

Another way to set up a new plugin project is to use a special maven archetype. When using this method you input certain parameters, which automatically generate the whole project with sample files (no need to change folder names or file names any more!). To do so you just need to have maven installed and be in the directory where you want your project. 

To generate a new plugin project use the following maven command:

Code Block

mvn archetype:generate -DarchetypeGroupId=com.qcadoo -DarchetypeArtifactId=qcadoo-plugin-archetype -DarchetypeRepository=http://nexus.qcadoo.org/content/repositories/releases -DarchetypeVersion=01.41.47-SNAPSHOT -DartifactId=warehouse -Dversion=01.41.47-SNAPSHOT -Didentifier=warehouse -Dname="Warehouse module" -DvendorName="Warehouse Corporation" -DvendorUrl=www.warehousecorp.com -Dpackage=com.warehousecorporation.warehouse -DgroupId=com.warehousecorporation
  • -DarchetypeGroupId - this should always have the value com.qcadoo, it identifies the group to which the archetype belongs to
  • -DarchetypeArtifactId - this should always have the value qcadoo-plugin-archetype, it identifies the artifact id of the archetype
  • -DarchetypeVersion - this will change with time, it identifies the archetype's version. Currently 0.4.3
  • -DarchetypeRepository=http://nexus.qcadoo.org/content/repositories/releases - our maven repository
  • -DartifactId - this will be your plugin's artifact id, like warehouse for example (set in the project's pom.xml)
  • -Dversion - this is your plugin's version, like 0.4.3 for example (set in the project's pom.xml)
  • -Didentifier - this will be your plugin's name, like warehouse for example. appropriate folders and files will be renamed using it (i.e. the locale files), it will be used in the sample view.xml and model.xml as the view/model names.
  • -Dname - this will be your plugin's name, like Warehouse module for example (set in the project's pom.xml)
  • -DvendorName - this will be the name of the vendor who developed the plugin, like Warehouse Corporation for example
  • -DvendorUrl - this will be the URL address of the vendor who developed the plugin, like www.warehousecorp.com for example
  • -DgroupId - optional parameter, this is your plugin's group id (set in the project's pom.xml), the default value is "com.qcadoo.mes"
  • -Dpackage - optional parameter, this should match your plugin's package structure which will be set in the root-context.xml, the default value is the same as the groupId 

You can skip all parameter and use only: 

Code Block
languagebash
mvn archetype:generate -DarchetypeGroupId=com.qcadoo -DarchetypeArtifactId=qcadoo-plugin-archetype -DarchetypeRepository=http://nexus.qcadoo.org/content/repositories/releases

In that case you will be prompted for all parameters in the command line. 

After running the aforementioned command a project with the following structure will be created:

  • src/
    • main/resources/
      • <identifier>/
        • model/
          • <identifier>.xml
        • view/
          • <identifier>.xml
        • locales/
          • <identifier>_en.properties
          • <identifier>_pl.properties
      • qcadoo-plugin.xml
      • root-context.xml
    • pom.xml

Where <identifier> will be replaced with the parameter you used. <identifier>.xml in the model and view folder are sample xml files for, respectively, the model and the view containing a simple view with a grid and a form and a model which contains 2 fields: a name and a number. Locale files contain all the necessary translations to get you up and running. 

Pom.xml, qcadoo-plugin.xml and root-context.xml are all automatically filled out with the mvn archetype:generate parameters.

Generate Eclipse project

To generate Eclipse project we need to open terminal and type mvn eclipse:eclipse.

...

Note
titleWhat should I do if I don't have Eclipse?

Please visit the download page and get the Eclipse IDE for Java Developers for suitable operating system.