Änderungen von Dokument Plugin-Entwicklung


Von Version 5.9
bearbeitet von awa
am 25.02.2022, 13:26
Änderungskommentar: Es gibt keinen Kommentar für diese Version
Auf Version 6.2
bearbeitet von awa
am 25.02.2022, 13:41
Änderungskommentar: Es gibt keinen Kommentar für diese Version

Zusammenfassung

Details

Seiteneigenschaften
Inhalt
... ... @@ -75,6 +75,8 @@
75 75  Alle Abhängigkeiten zu {{formcycle case="dat"/}} sind im scope "provided" zu definieren!
76 76  {{/info}}
77 77  
78 +Eine fertige einfache //pom.xml// können Sie [[hier herunterladen>>attach:pom.xml||rel="__blank"]].
79 +
78 78  Ausgangspunkt für die Entwicklung von Plugin ist das Maven-Artefakt //fc-plugin-common//. Dieses enthält die einzelnen Plugin-Schnittstellen und steht auch auf [[unserere Downloadseite zur Verfügung>>url:http://artifactory.xima-services.de/artifactory/fc-plugin-dev/de/xima/fc/fc-plugin-common||target="_blank"]].
79 79  
80 80  In der //pom.xml// des Plugin-Projekts kann diese Abhängigkeit wie folgt eingebunden werden:
... ... @@ -105,7 +105,7 @@
105 105   </dependency>
106 106  {{/code}}
107 107  
108 -Eine entsprechende Benutzung ist vor allem bei der Verwendung der Datenbankschnittstelle sowie bei der Implementierung von eigenen Verarbeitungen nötig. Eine Vorlage für ein somit entstehendes Project Object Model finden Sie [[hier>>attach:pom.xml||rel="__blank"]].
110 +Eine entsprechende Benutzung ist vor allem bei der Verwendung der Datenbankschnittstelle sowie bei der Implementierung von eigenen Verarbeitungen nötig.
109 109  
110 110  Ferner ist zu beachten, dass sämtliche Abhängigkeiten zu {{formcycle case="dat"/}} im scope //provided //anzugeben sind. Dies verhindert neben Classpath-Problemen auch das unnötige Anschwellen der Plugin-Größe. Ebenso sollten diesbezüglich Abhängigkeiten auf bereits von {{formcycle case="dat"/}} benutzten und damit bereitstehenden Bibliotheken wiederverwendet werden (z.B. diverse Apache Commons-Implementierungen).
111 111  
... ... @@ -136,7 +136,7 @@
136 136   <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
137 137   </properties>
138 138   <build>
139 - <finalName>${project.parent.artifactId}</finalName>
141 + <finalName>${project.artifactId}</finalName>
140 140   <plugins>
141 141   <plugin>
142 142   <groupId>org.apache.maven.plugins</groupId>
... ... @@ -150,7 +150,7 @@
150 150   <goal>single</goal>
151 151   </goals>
152 152   <configuration>
153 - <finalName>${project.parent.artifactId}</finalName>
155 + <finalName>${project.artifactId}</finalName>
154 154   <appendAssemblyId>false</appendAssemblyId>
155 155   <descriptorRefs>
156 156   <descriptorRef>jar-with-dependencies</descriptorRef>
pom.xml
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.rth
1 +XWiki.awa
Größe
... ... @@ -1,1 +1,1 @@
1 -2.2 KB
1 +6.1 KB
Inhalt
... ... @@ -2,23 +2,29 @@
2 2   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 3   <modelVersion>4.0.0</modelVersion>
4 4  
5 + <!-- MUST BE FILLED IN -->
5 5   <groupId></groupId>
6 6   <artifactId></artifactId>
7 7   <version></version>
8 - <packaging>jar</packaging>
9 -
10 10   <name></name>
11 11  
11 + <packaging>jar</packaging>
12 +
12 12   <properties>
13 13   <!-- Configuration -->
14 14   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15 15  
16 16   <!-- Dependencies -->
17 - <xfc-version>7.0.9</xfc-version>
18 + <xfc.version>7.0.10</xfc.version>
19 + <junit-jupiter.version>5.6.0</junit-jupiter.version>
18 18  
19 19   <!-- Plugins -->
20 - <maven-compiler-plugin-version>3.8.1</maven-compiler-plugin-version>
21 - <maven-jar-plugin-version>3.1.0</maven-jar-plugin-version>
22 + <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
23 + <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
24 + <maven-jar-plugin.version>3.1.0</maven-jar-plugin.version>
25 + <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
26 + <fc-deploy-plugin-maven-plugin.version>7.0.1<fc-deploy-plugin-maven-plugin.version/>
27 + <fc-server-maven-plugin.version>7.0.1</fc-server-maven-plugin.version>
22 22   </properties>
23 23  
24 24   <repositories>
... ... @@ -30,27 +30,72 @@
30 30   </repositories>
31 31  
32 32   <dependencies>
39 + <!-- Reference FORMCYCLE libraries. The plugin is installed in a running -->
40 + <!-- FORMCYCLE system, , so you do not need to include the FORMCYCLE libraries -->
41 + <!-- in the plugin JAR. This is done by setting the scope to "provided" -->
33 33   <dependency>
34 34   <groupId>de.xima.fc</groupId>
35 - <artifactId>fc-plugin-common</artifactId>
36 - <version>${xfc-version}</version>
44 + <artifactId>fc-logic</artifactId>
45 + <version>${xfc.version}</version>
37 37   <scope>provided</scope>
38 38   </dependency>
39 39  
49 + <!-- JUnit for writing unit tests -->
40 40   <dependency>
41 - <groupId>de.xima.fc</groupId>
42 - <artifactId>fc-logic</artifactId>
43 - <version>${xfc-version}</version>
44 - <scope>provided</scope>
51 + <groupId>org.junit.jupiter</groupId>
52 + <artifactId>junit-jupiter</artifactId>
53 + <version>${junit-jupiter.version}</version>
54 + <scope>test</scope>
45 45   </dependency>
56 +
57 + <!-- You can add additional dependencies here. -->
58 + <!-- Some common libraries as apache-commons and guava are provided by -->
59 + <!-- FORMCYCLE and can be set to scope=provided. -->
60 +
46 46   </dependencies>
47 47  
48 48   <build>
64 + <finalName>${project.artifactId}</finalName>
65 +
49 49   <plugins>
67 +
68 + <!-- Upload the plugin to a running FORMCYCLE server as part of the Maven build process -->
69 + <!-- mvn clean install -DfcDeployUrl=http://localhost:8080/xima-formcycle -DfcDeployToken=admin -->
50 50   <plugin>
71 + <groupId>de.xima.fc.maven.plugin</groupId>
72 + <artifactId>fc-deploy-plugin-maven-plugin</artifactId>
73 + <version>${fc-deploy-plugin-maven-plugin.version}</version>
74 + <executions>
75 + <execution>
76 + <id>upload</id>
77 + <phase>install</phase>
78 + <goals>
79 + <goal>deploy</goal>
80 + </goals>
81 + </execution>
82 + </executions>
83 + </plugin>
84 +
85 + <!-- Start a preconfigured FORMCYCLE server-->
86 + <!-- mvn fc-server:run-ms-war -->
87 + <plugin>
88 + <groupId>de.xima.fc.maven.plugin</groupId>
89 + <artifactId>fc-server-maven-plugin</artifactId>
90 + <version>${fc-server-maven-plugin.version}</version>
91 + <configuration>
92 + <bootstrap>
93 + <pluginManagement>
94 + <deployMavenProject>true</deployMavenProject>
95 + </pluginManagement>
96 + </bootstrap>
97 + </configuration>
98 + </plugin>
99 +
100 + <!-- Configure the compilation process. At least Java 11 is required. -->
101 + <plugin>
51 51   <groupId>org.apache.maven.plugins</groupId>
52 52   <artifactId>maven-compiler-plugin</artifactId>
53 - <version>${maven-compiler-plugin-version}</version>
104 + <version>${maven-compiler-plugin.version}</version>
54 54   <configuration>
55 55   <release>11</release>
56 56   <encoding>UTF-8</encoding>
... ... @@ -59,10 +59,11 @@
59 59   </configuration>
60 60   </plugin>
61 61  
113 + <!-- Configure how the JAR is created, including manifest entries -->
62 62   <plugin>
63 63   <groupId>org.apache.maven.plugins</groupId>
64 64   <artifactId>maven-jar-plugin</artifactId>
65 - <version>${maven-jar-plugin-version}</version>
117 + <version>${maven-jar-plugin.version}</version>
66 66   <configuration>
67 67   <archive>
68 68   <manifest>
... ... @@ -69,11 +69,58 @@
69 69   <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
70 70   </manifest>
71 71   <manifestEntries>
72 - <formcycle-version-requirement>${xfc-version}</formcycle-version-requirement>
124 + <formcycle-version-requirement>${xfc.version}</formcycle-version-requirement>
125 + <Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
126 + <Implementation-Title>${project.groupId}:${project.artifactId}</Implementation-Title>
127 + <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
128 + <Implementation-Version>${project.version}</Implementation-Version>
73 73   </manifestEntries>
74 74   </archive>
75 75   </configuration>
76 76   </plugin>
133 +
134 + <!-- Build a fat JAR with all dependencies included -->
135 + <plugin>
136 + <groupId>org.apache.maven.plugins</groupId>
137 + <artifactId>maven-assembly-plugin</artifactId>
138 + <version>${maven-assembly-plugin.version}</version>
139 + <executions>
140 + <execution>
141 + <id>fat-jar</id>
142 + <phase>package</phase>
143 + <goals>
144 + <goal>single</goal>
145 + </goals>
146 + <configuration>
147 + <finalName>${project.artifactId}</finalName>
148 + <appendAssemblyId>false</appendAssemblyId>
149 + <descriptorRefs>
150 + <descriptorRef>jar-with-dependencies</descriptorRef>
151 + </descriptorRefs>
152 + <archive>
153 + <manifest>
154 + <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
155 + </manifest>
156 + <manifestEntries>
157 + <formcycle-version-requirement>${xfc.version}</formcycle-version-requirement>
158 + <Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
159 + <Implementation-Title>${project.groupId}:${project.artifactId}</Implementation-Title>
160 + <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
161 + <Implementation-Version>${project.version}</Implementation-Version>
162 + </manifestEntries>
163 + </archive>
164 + </configuration>
165 + </execution>
166 + </executions>
167 + </plugin>
168 +
169 + <!-- Use JUnit to run test classes -->
170 + <plugin>
171 + <groupId>org.apache.maven.plugins</groupId>
172 + <artifactId>maven-surefire-plugin</artifactId>
173 + <version>${maven-surefire-plugin.version}</version>
174 + </plugin>
77 77   </plugins>
78 78   </build>
79 79  </project>
178 +