... |
... |
@@ -373,5
+373,181 @@ |
373 |
373 |
} |
374 |
374 |
{{/code}} |
375 |
375 |
|
376 |
|
-== Beispiel für Maven == |
|
376 |
+== Maven-Deploy-Plugin == |
377 |
377 |
|
|
378 |
+Um ein Plugin nach dem Bauen über Maven in FORMCYCLE hochzuladen, gibt es auch ein Maven-Plugin, welches das Deploy-Servlet anspricht. Dieses ist über die Artifactory von XIMA erhältlich, falls man die entsprechenden Rechte hierfür hat: |
|
379 |
+ |
|
380 |
+=== Konfiguration |
|
381 |
+ |
|
382 |
+{{code language="xml"}} |
|
383 |
+<plugin> |
|
384 |
+ <groupId>de.xima.fc.maven.plugin</groupId> |
|
385 |
+ <artifactId>fc-deploy-plugin-maven-plugin</artifactId> |
|
386 |
+ <version>1.1.0</version> |
|
387 |
+ <configuration> |
|
388 |
+ <url>http://localhost:8080/formcycle</url> |
|
389 |
+ <pluginName>deploy-plugin</pluginName> |
|
390 |
+ <clientId>52</clientId> |
|
391 |
+ <token>admin</token> |
|
392 |
+ <deployAction>save</deployAction> |
|
393 |
+ <pluginIdent>name</manifest> |
|
394 |
+ <pluginIdentifier>my-plugin.jar</pluginIdentifier> |
|
395 |
+ <jarFile></jarFile> |
|
396 |
+ <disallowInstall>false</disallowInstall> |
|
397 |
+ <locale>en</locale> |
|
398 |
+ <clearProperties>true</clearProperties> |
|
399 |
+ <properties> |
|
400 |
+ <property1>value1</property1> |
|
401 |
+ <property2>value2</property2> |
|
402 |
+ <properties> |
|
403 |
+ </configuration> |
|
404 |
+</plugin> |
|
405 |
+{{/code}} |
|
406 |
+ |
|
407 |
+Das Plugin hat die folgenden Optionen zur Konfiguration: |
|
408 |
+ |
|
409 |
+; url [Standardwert: //${fcDeployUrl}//] |
|
410 |
+: URL mit Kontextpfad zum FORMCYCLE-Server, etwa //{{{http://localhost:8080/formcycle}}}// |
|
411 |
+; pluginName [Standardwert: //deploy-plugin//] |
|
412 |
+: Der Name des Deploy-Plugins für den URL-Parameter //name//. In der Regel muss diese Option nicht gesetzt werden, der Standardwert ist ausreichend. |
|
413 |
+; clientId [Standardwert: //${fcDeployClientId}//] |
|
414 |
+: ID des Mandanten, für den das Plugin installiert, aktualisiert oder gelöscht werden soll. Entspricht dem Parameter //client-id// des Deploy-Plugins, siehe oben. |
|
415 |
+; clientUuid |
|
416 |
+: Alternative zu //clientID//. UUID des Mandanten, für den das Plugin installiert, aktualisiert oder gelöscht werden soll. Entspricht dem Parameter //client-uuid// des Deploy-Plugins, siehe oben. |
|
417 |
+; token [Standardwert: //${fcDeployToken}//] |
|
418 |
+: Passwort für das Servlet-Plugin, falls in der Konfiguration des Deploy-Plugins ein Passwort gesetzt wurde. |
|
419 |
+; deployAction [Standardwert: //save//] |
|
420 |
+: Aktion, welche mit dem Plugin durchgeführt werden soll. Erlaubte Werte sind //save//, //update-properties//, //activate//, //deactivate// und //delete//. Entspricht dem Parameter //deploy-action// des Deploy-Plugins, siehe oben. |
|
421 |
+; pluginIdent [Standardwert: //manifest//] |
|
422 |
+: Die Art, wie nach einem vorhandenen Plugin gesucht wird. Entspricht dem Parameter //plugin-ident// des Deploy-Plugins, siehe oben. |
|
423 |
+; pluginIdentifier [Standardwert: //Implementation-Title=${project.groupId}:${project.artifactId}//] |
|
424 |
+: Identifikator des Plugins, welches aktualisiert oder gelöscht werden soll. Entspricht dem Parameter //plugin-identifier// des Deploy-Plugins, siehe oben. |
|
425 |
+; jarFile [Standartwert: Haupt-Build-Artifakt des Maven-Projekts] |
|
426 |
+: Pfad zur JAR-Datei, die hochgeladen werden soll, relativ zum Basisverzeichnis des Maven-Projekts. |
|
427 |
+; disallowInstall [Standardwert: //false//] |
|
428 |
+: Wenn //true// und das Plugin noch nicht existiert, wird abgebrochen und ein Fehler zurückgegeben. Entspricht dem Parameter //disallow-install// des Deploy-Plugins, siehe oben. |
|
429 |
+; locale [Standardwert: //en//] |
|
430 |
+: Sprache, die für die Installation, Aktualisierung oder Löschung des Plugins genutzt wird. Entspricht dem Parameter //locale// des Deploy-Plugins, siehe oben. |
|
431 |
+; clearProperties [Standardwert: //false//] |
|
432 |
+: Löscht die Werte aller Plugin-Eigenschaften. Entspricht dem Parameter //clear-properties// des Deploy-Plugins, siehe oben. |
|
433 |
+; properties |
|
434 |
+: Key-Value-Paare mit Eigenschaften, die an dem Plugin gesetzt werden sollen. Entspricht dem Parameter //clear-properties// des Deploy-Plugins, siehe oben. |
|
435 |
+ |
|
436 |
+=== Empfehlung für Plugin-Projekt |
|
437 |
+ |
|
438 |
+Während das Plugin zahlreiche Einstellunsgmöglichkeiten anbietet, reichen meist die Standardwerte aus. Empfohlen wird das folgende Vorgehen bei der Entwicklung von Plugin-Projekten. |
|
439 |
+ |
|
440 |
+Folgendes Schnippsel sollte in der Profil-Sektion der //pom.xml// eingefügt werden: |
|
441 |
+ |
|
442 |
+{{code language="xml"}} |
|
443 |
+ <properties> |
|
444 |
+ <fc-deploy-plugin-maven-plugin.version>1.1.0</fc-deploy-plugin-maven-plugin.version> |
|
445 |
+ </properties> |
|
446 |
+ |
|
447 |
+ <profiles> |
|
448 |
+ <profile> |
|
449 |
+ <id>fc-deploy</id> |
|
450 |
+ <activation> |
|
451 |
+ <property> |
|
452 |
+ <name>fcDeployUrl</name> |
|
453 |
+ </property> |
|
454 |
+ </activation> |
|
455 |
+ <build> |
|
456 |
+ <plugins> |
|
457 |
+ <plugin> |
|
458 |
+ <groupId>de.xima.fc.maven.plugin</groupId> |
|
459 |
+ <artifactId>fc-deploy-plugin-maven-plugin</artifactId> |
|
460 |
+ <version>${fc-deploy-plugin-maven-plugin.version}</version> |
|
461 |
+ <executions> |
|
462 |
+ <execution> |
|
463 |
+ <goals> |
|
464 |
+ <goal>install</goal> |
|
465 |
+ </goals> |
|
466 |
+ </execution> |
|
467 |
+ </executions> |
|
468 |
+ </plugin> |
|
469 |
+ </plugins> |
|
470 |
+ </build> |
|
471 |
+ </profile> |
|
472 |
+ </profiles> |
|
473 |
+{{/code}} |
|
474 |
+ |
|
475 |
+Das Plugin wird dann anhand des Eintrags //Implementation-Title// im Manifest identifiziert. Hierzu muss der Wert korrekt im Manifest gesetzt werden. Dies kann entweder über das maven-jar-plugin oder über das maven-assembly-plugin geschehen, je nachdem, welches von diesen im Plugin-Projekt genutzt wird: |
|
476 |
+ |
|
477 |
+{{code language="xml"}} |
|
478 |
+ <properties> |
|
479 |
+ <xfc.version>6.4.0-SNAPSHOT</xfc.version> |
|
480 |
+ <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version> |
|
481 |
+ <maven-assembly-plugin.version>3.2.0</maven-assembly-plugin.version> |
|
482 |
+ </properties> |
|
483 |
+ |
|
484 |
+ <build> |
|
485 |
+ <plugins> |
|
486 |
+ |
|
487 |
+ <!-- If using the maven-jar-plugin --> |
|
488 |
+ <plugin> |
|
489 |
+ <groupId>org.apache.maven.plugins</groupId> |
|
490 |
+ <artifactId>maven-jar-plugin</artifactId> |
|
491 |
+ <version>${maven-jar-plugin.version}</version> |
|
492 |
+ <configuration> |
|
493 |
+ <outputDirectory>${basedir}</outputDirectory> |
|
494 |
+ <finalName>${project.artifactId}</finalName> |
|
495 |
+ <archive> |
|
496 |
+ <manifest> |
|
497 |
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries> |
|
498 |
+ </manifest> |
|
499 |
+ <manifestEntries> |
|
500 |
+ <formcycle-version-requirement>${xfc.version}</formcycle-version-requirement> |
|
501 |
+ <Implementation-Title>${project.groupId}:${project.artifactId}</Implementation-Title> |
|
502 |
+ <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id> |
|
503 |
+ <Implementation-Version>${project.version}</Implementation-Version> |
|
504 |
+ <Build-Timestamp>${maven.build.timestamp}</Build-Timestamp> |
|
505 |
+ </manifestEntries> |
|
506 |
+ </archive> |
|
507 |
+ </configuration> |
|
508 |
+ </plugin> |
|
509 |
+ |
|
510 |
+ <!-- If using the maven-assembly-plugin --> |
|
511 |
+ <plugin> |
|
512 |
+ <groupId>org.apache.maven.plugins</groupId> |
|
513 |
+ <artifactId>maven-assembly-plugin</artifactId> |
|
514 |
+ <version>${maven-assembly-plugin.version}</version> |
|
515 |
+ <executions> |
|
516 |
+ <execution> |
|
517 |
+ <id>fat-jar</id> |
|
518 |
+ <phase>package</phase> |
|
519 |
+ <goals> |
|
520 |
+ <goal>single</goal> |
|
521 |
+ </goals> |
|
522 |
+ <configuration> |
|
523 |
+ <outputDirectory>${basedir}</outputDirectory> |
|
524 |
+ <finalName>${project.artifactId}</finalName> |
|
525 |
+ <descriptorRefs> |
|
526 |
+ <descriptorRef>jar-with-dependencies</descriptorRef> |
|
527 |
+ </descriptorRefs> |
|
528 |
+ <appendAssemblyId>false</appendAssemblyId> |
|
529 |
+ <archive> |
|
530 |
+ <manifestEntries> |
|
531 |
+ <Build-Timestamp>${maven.build.timestamp}</Build-Timestamp> |
|
532 |
+ <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id> |
|
533 |
+ <Implementation-Title>${project.groupId}:${project.artifactId}</Implementation-Title> |
|
534 |
+ <Implementation-Version>${project.version}</Implementation-Version> |
|
535 |
+ <formcycle-version-requirement>${xfc.version}</formcycle-version-requirement> |
|
536 |
+ </manifestEntries> |
|
537 |
+ </archive> |
|
538 |
+ </configuration> |
|
539 |
+ </execution> |
|
540 |
+ </executions> |
|
541 |
+ </plugin> |
|
542 |
+ |
|
543 |
+ </plugins> |
|
544 |
+ </build> |
|
545 |
+{{/code}} |
|
546 |
+ |
|
547 |
+Nun kann das Plugin über Maven gebaut und hochgeladen werden. Die URL auf FORMCYCLE, die Mandant-ID und das Token (Passwort) wird dynamisch über Parameter an Maven übergeben: |
|
548 |
+ |
|
549 |
+{{code language="bash"}} |
|
550 |
+mvn clean install -DfcDeployUrl="http://localhost:8080/xima-formcycle" -DfcDeployClientId="1" -DfcDeployToken="admin" |
|
551 |
+{{/code}} |
|
552 |
+ |
|
553 |
+Hinweis: IDE wie Eclipse und IntelliJ erlauben es, eine Build-Konfiguration für das Plugin-Projekt zu erstellen, wo die Parameter //fcDeployUrl//, //fcDeployClientId// und //fcDeployToken// hinterlegt werden können. |