Changes for page Plugin-Entwicklung


From version 1.2
edited by awa
on 25.02.2022, 14:54
Change comment: There is no comment for this version
To version 1.27
edited by awa
on 15.03.2023, 18:15
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -70,7 +70,7 @@
70 70  
71 71  The following lists a few important steps required for setting up a Maven project for a {{formcycle/}} plugin, but we assume you have basic knowledge of how to work with Maven.
72 72  
73 -To get started with a plugin, you can also use of of the available [[Maven archetypes>>||anchor="HMaven-Archetypes"]].
73 +To get started with a plugin, you can also use of of the available [[Maven archetypes>>||anchor="HMavenarchetypes"]].
74 74  
75 75  === Artekfakte und Abhängigkeiten
76 76  
... ... @@ -86,7 +86,7 @@
86 86  
87 87  {{code language="xml"}}
88 88   <properties>
89 - <xfc.version>7.0.10</xfc.version>
89 + <xfc.version>7.2.1</xfc.version>
90 90   </properties>
91 91  
92 92   <dependencies>
... ... @@ -110,8 +110,26 @@
110 110   </dependency>
111 111  {{/code}}
112 112  
113 -Note that all dependencies must be declared with the //provide// scope. This prevents class path issues and keeps the plugin size small. When possible, use libraries already used by {{formcycle/}}, e.g. certain Apache Common libraries or guava.
113 +Note that all dependencies must be declared with the //provide// scope. This prevents class path issues and keeps the plugin size small. When possible, use libraries already used by {{formcycle/}}, e.g. certain Apache Common libraries or guava. Also use the provided scope for such dependencies. A simple way to manage versions and avoid mistakes is by including the FORMCYCLE Bom:
114 114  
115 +{{code language="xml"}}
116 + <dependencyManagement>
117 + <dependencies>
118 + <!--Import dependency versions from FORMCYCLE -->
119 + <dependency>
120 + <groupId>de.xima.fc</groupId>
121 + <artifactId>fc</artifactId>
122 + <version>${xfc.version}</version>
123 + <type>pom</type>
124 + <scope>import</scope>
125 + </dependency>
126 + </dependencies>
127 + </dependencyManagement>
128 +{{/code}}
129 +
130 +Then just declare the dependency you wish to use without a {{code}}<version>...</version>{{/code}}. If FORMCYCLE already provides that dependency, you won't get a build error. Otherwise you need to include the dependency in the plugin: Remove the provided scope and add the version.
131 +
132 +
115 115  === Manifest und Fat JAR
116 116  
117 117  The //META-INF/MANIFEST.MF// file in the plugin JAR should contain the following entries:
... ... @@ -120,11 +120,15 @@
120 120  : Required. The version of {{formcycle/}} against which the plugin was compiled. This is required for {{formcycle/}} to check the compatibility when the plugin is installed.
121 121  ; Implementation-Version
122 122  : Required. The version of the plugin, which is for example shown in the UI.
141 +; Plugin-Key
142 +: Required. This is used by {{formcycle/}} to identify the plugin, and also used by e.g. the deploy or server plugin. Recommended value is {{code}}${project.groupId}:${project.artifactId}{{/code}}.
123 123  ; Build-Time oder Build-Timestamp
124 124  : Optional. This is displayed in the UI when the plugin version is a SNAPSHOT.
125 -; Implementation-Title
126 -: Optional. This is used e.g. by the deploy plugin to identify the plugin.
127 127  
146 +{{info}}
147 +Up until and including version 7.x of {{formcycle/}}, {{code}}Implementation-Title{{/code}} with the same value as {{code}}Plugin-Key{{/code}} is also required.
148 +{{/info}}
149 +
128 128  You can use the //maven-assembly-plugin// to add these entries to the manifest.
129 129  
130 130  Furthermore, it is required that you create a fat JAR. Dependencies provided by {{formcycle/}} should be declared with the scope //provided//, as mentioned above. However, any additional dependencies that your plugin needs must be included in the JAR file.
... ... @@ -189,48 +189,48 @@
189 189  
190 190  This creates a JAR file in the //target// folder. You can then upload this plugin to a running {{formcycle/}} server, either as a [[client plugin>>doc:Formcycle.UserInterface.Client.Plugins]] or as a [[system plugin>>doc:Formcycle.SystemSettings.UserInterface.SystemPlugins]].
191 191  
192 -See the [[deploy plugin>>||anchor="HDeployPlugin"]] to upload the plugin to a running {{formcycle/}} server during the Maven build process.
214 +See the [[deploy plugin>>||anchor="HDeployplugin"]] to upload the plugin to a running {{formcycle/}} server during the Maven build process.
193 193  
194 -See the [[FC server plugin>>||anchor="HFCServerPlugin"]] for starting a simple {{formcycle/}} server.
216 +See the [[FC server plugin>>||anchor="HFCserverplugin"]] for starting a simple {{formcycle/}} server.
195 195  
196 -== Maven-Archetypes ==
218 +== Maven archetypes ==
197 197  
198 198  {{figure image="eclipse-archetype.png" width="500"}}
199 - Hinzufügen des Archetypes-Katalogs in Eclipse
221 + Adding an archetype catalog in Eclipse
200 200  {{/figure}}
201 201  
202 202  {{figure image="eclipse-archetype-select.png" width="500"}}
203 - Auswahl eines Archetypes beim Erstellen eines Maven-Projekts in Eclipse
225 + Selecting an archetype in Eclispe when creating a new Maven project
204 204  {{/figure}}
205 205  
206 -Für einige häufig verwendete Plugin-Typen stehen [[Maven-Archetypes>>url:https://maven.apache.org/guides/introduction/introduction-to-archetypes.html||target="_blank"]] bereits, um schnell ein Maven-Projekt aufsetzen zu können.
228 +For some common plugin types, we provide [[Maven archetypes>>url:https://maven.apache.org/guides/introduction/introduction-to-archetypes.html||target="_blank"]] to help you get started.
207 207  
208 -Voraussetzung für die Verwendung ist, dass in den //~~/.m2/settings.xml// wie oben beschrieben das XIMA-Artifactory eingerichtet wurde. Dann kann etwa über die Kommandozeile wie folgt eine Archetype generiert werden:
230 +If you added the XIMA artifactory to the //~~/.m2/settings.xml// as described above, you can create a new plugin project from an archetype via the following CLI command:
209 209  
210 210  {{code}}
211 -mvn archetype:generate -DarchetypeArtifactId=plugin-archetype-workflow-element-simple -DarchetypeGroupId=de.xima.fc.archetype -DarchetypeVersion=7.0.4
233 +mvn archetype:generate -DarchetypeArtifactId=plugin-archetype-workflow-element-simple -DarchetypeGroupId=de.xima.fc.archetype
212 212  {{/code}}
213 213  
214 -Es werden dann einige wenige Informationen wie die gewünschten Maven-Koordinaten des neuen Plugin-Projekts abgefragt und anschließend ein neues vorkonfiguriertes Projekt erstellt.
236 +This prompts for a few required details such as the desired Maven coordinates of the new project, then creates a new folder in the current working directory with a preconfigured Maven project.
215 215  
216 -Alle vorhandenen Archetypes und deren Versionen können im [[Archetype-Katalog>>url:https://artifactory.xima-services.de/artifactory/libs-release-local/archetype-catalog.xml||target="_blank"]] eingesehen werden.
238 +See the [[archetype catalog>>url:https://artifactory.xima-services.de/artifactory/libs-release-local/archetype-catalog.xml||target="_blank"]] for a list of available archetypes.
217 217  
218 -In Eclipse kann der Archetype-Katalog in den Einstellungen hinzugefügt werden. Bei der Erstellung eines neuen Maven-Projekt werden dann alle verfügbaren Archetypes angezeigt:
240 +If you are using Eclipse, you can also add the archetype catalog in the Eclipse settings. Eclipse will then show you the available archetypes when you create a new Maven project with the builtin wizard.
219 219  
220 220  {{code language="plaintext"}}https://artifactory.xima-services.de/artifactory/libs-release-local/archetype-catalog.xml{{/code}}
221 221  
222 -== Deploy-Plugin
244 +== Deploy plugin
223 223  
224 -Um beim Entwickeln nicht jedes Mal eine neue Plugin-Version manuell über die Oberfläche hochladen zu ssen, kann das Deploy-Plugin verwendet werden. Dieses besteht aus 2 Teilen:
246 +When developing a plugin, you often need to build a new snapshot version and upload it to a running {{formcycle/}} server. To ease that process, the deploy plugin can be used to upload the plugin automatically as part of the Maven build process. It consists of two parts:
225 225  
226 -* Ein Maven-Plugin, welches nach dem Bauen das Plugin via HTTP an einen laufenden {{formcycle/}}-Server sendet
227 -* Ein Plugin für {{formcycle/}}, welche die Gegenstelle in {{formcycle/}} bereitstellt und das Plugin aus dem HTTP-Request in {{formcycle/}} installiert.
248 +* A Maven plugin, which is run at the end of the build process and sends the plugin JAR file to a running {{formcycle/}} server via HTTP.
249 +* A {{formcycle/}} plugin, which provides the endpoint that takes the plugin from the HTTP requests and installs it to {{formcycle/}}.
228 228  
229 -Weitere Details können im [[Hilfe-Artikel zum Deploy-Plugin>>doc:Formcycle.PluginDocumentation.FormcycleDeployPluginPlugin]] nachgelesen werden. Für die meisten Fälle reicht folgende Konfiguration in der //pom.xml// des Plugin-Projekts aus:
251 +For more details, see [[help page of the deploy plugin>>doc:Formcycle.PluginDocumentation.FormcycleDeployPluginPlugin]]. For most cases, you do not need any configuration in your pom, but we recommend you at least pin the version to a specific release:
230 230  
231 231  {{code language="xml"}}
232 232   <properties>
233 - <fc-deploy-plugin-maven-plugin.version>7.0.1<fc-deploy-plugin-maven-plugin.version/>
255 + <fc-deploy-plugin-maven-plugin.version>7.0.1</fc-deploy-plugin-maven-plugin.version>
234 234   <build>
235 235   <plugins>
236 236   <plugin>
... ... @@ -237,39 +237,62 @@
237 237   <groupId>de.xima.fc.maven.plugin</groupId>
238 238   <artifactId>fc-deploy-plugin-maven-plugin</artifactId>
239 239   <version>${fc-deploy-plugin-maven-plugin.version}</version>
240 - <executions>
241 - <execution>
242 - <id>upload</id>
243 - <phase>install</phase>
244 - <goals>
245 - <goal>deploy</goal>
246 - </goals>
247 - </execution>
248 - </executions>
249 249   </plugin>
250 250   </plugins>
251 251   </build>
252 252  {{/code}}
253 253  
254 -Sofern das Deploy-Plugin bereits in {{formcycle/}} installiert ist, kann das Plugin-Projekt dann beim Bauen wie folgt hochgeladen werden:
267 +Assuming the deploy plugin is installed as a system plugin of a {{formcycle/}} server, you can build and upload your plugin project as follows:
255 255  
256 256  {{code language="bash"}}
257 -mvn clean install -DfcDeployUrl=http://localhost:8080/xima-formcycle -DfcDeployToken=admin
270 +mvn fc-deploy:deploy
258 258  {{/code}}
259 259  
260 -Wird Eclipse benutzt, kann auch eine Launch-Configuration mit den //fcDeployUrl// und dem //fcDeployToken// angelegt werden.
273 +This assumes that {{formcycle/}} is running on the standard URL {{code}}http://localhost:8080/xima-formcycle{{/code}} and that the deploy plugin uses the default password "admin". If that is not the case, you can also change these values:
261 261  
262 -== FC-Server-Plugin ==
275 +{{code language="bash"}}
276 +mvn package fc-deploy:deploy -DfcDeployUrl=http://localhost:8080/xima-formcycle -DfcDeployToken=admin
277 +{{/code}}
263 263  
264 -Zum Testen eines Plugins ist es erforderlich, einen laufenden {{formcycle/}}-Server zu haben. Zur Vereinfachung der Entwicklung gibt es das //fc-server-maven-plugin//, welches mittels eines einzigen Befehls ein fertig eingerichtetes {{formcycle/}} lokal startet, wo auch bereits das Deploy-Plugin vorinstalliert ist.
279 +{{info}}
280 + Up to and including version 7.x of {{formcycle/}} and the Maven plugin, you need to run the package phase explicitly and always specify the URL and the password. Starting with version 8.x, the package phase is executed automatically and the URL and password have default values.
281 +{{/info}}
265 265  
266 -Sofern wie oben beschrieben in //~~/.m2/settings.xml// die //pluginGroup// hinterlegt wurde, kann in einem beliebiegen Verzeichnis wie folgt ein {{formcycle/}}-Server per Maven gestartet werden:
283 +If you want to upload the plugin in a client scope, add the parameter //-DfcDeployClientId=3// with the ID of the client.
267 267  
285 +== FC server plugin ==
286 +
287 +To test a plugin, you will need a running {{formcycle/}} server. The //fc-server-maven-plugin// can be used to start a fully configured {{formcycle/}} server with just a single command. It also comes with the deploy plugin preinstalled.
288 +
289 +If you added the //pluginGroup// to the //~~/.m2/settings.xml// as described above, you can start a {{formcycle/}} server with the following CLI command:
290 +
268 268  {{code language="bash"}}
269 -mvn fc-server:run-ms-war -DxfcVersion=7.0.10
292 +# Start the current version
293 +mvn fc-server:run-ms-war
294 +
295 +# Start a specific version
296 +mvn de.xima.fc.maven.plugin:fc-server-maven-plugin:7.0.4:run-ms-war -DxfcVersion=7.0.16
270 270  {{/code}}
271 271  
272 -Nach kurzer Wartezeit (beim ersten Mal kann es länger dauern) ist dann ein {{formcycle/}}-Server gestartet. Die URL steht am Ende in der Kommandozeile, standardmäßig http://localhost:8080/xima-formcycle
299 +{{info}}
300 + We recommend you use Java 11. You may encounter issues when yout attempt to start {{formcycle/}} with Java 17.
301 +{{/info}}
273 273  
274 -Dies funktioniert auch in einem Ordner ohne Maven-Projekt. Falls keine {{formcycle/}} angegeben ist, wird eine Standard-Version genommen. Wird der Befehl innerhalb eines Plugin-Maven-Projekts ausgeführt, wird versucht, die Version von {{formcycle/}} aus dem Plugin-Projekt auszulesen.
303 +{{info}}
304 + Up to and including version 7.x of {{formcycle/}} and the Maven plugin, you need to run the package phase explicitly: {{code}}mvn package fc-server:run-ms-war{{/code}}. Starting with version 8.x, this is not required anymore.
305 +{{/info}}
275 275  
307 +{{info}}
308 + The major and minor version of the Maven plugin should always be equal to the major and minor version of the {{formcycle/}} application you are running. For example, to start {{formcycle/}} 7.0.x, you should the Maven plugin version 7.0.x. To start {{formcycle/}} 7.1.x, you should use the Maven plugin version 7.1.x etc.
309 +{{/info}}
310 +
311 +After a short amount of time (may take longer when you start it for the first time), you have a local {{formcycle/}} server running. The URL is printed in the command line, and should be http://localhost:8080/xima-formcycle by default. The super user login is {{code language="plaintext"}}sadmin{{/code}} (password: {{code language="plaintext"}}admin{{/code}}), the client admin access is {{code language="plaintext"}}admin{{/code}} (password {{code language="plaintext"}}/admin_{{/code}}).
312 +
313 +When you run the command in the root folder of a Maven project, the project is packaged, uploaded to server and installed. Also, the FC server Maven plugin tries to read the {{formcycle/}} version from the plugin.
314 +
315 +Falls der Befehl in einem Maven-Projekt eines {{formcycle/}}-Plugins ausgeführt wird, dann wird das Plugin automatisch gebaut und nach dem Starten des Servers hochgeladen und installiert.
316 +
317 +This command works even in a directory without a Maven project. When no {{formcycle/}} version is given, a default one is used.
318 +
319 +For advanced usage, see the [[README.md>>attach:README-FC-SERVER.md||rel="__blank"]].
320 +