Changes for page Maven XAR Plugin

Last modified by Vincent Massol on 2021/04/09 18:01

<
From version < 25.1 >
edited by Eduard Moraru
on 2018/09/03 17:19
To version < 26.1 >
edited by Paul Libbrecht
on 2019/05/03 09:50
>
Change comment: Added a section to document newer transformations for https://jira.xwiki.org/browse/XCOMMONS-1614

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.enygma
1 +xwiki:XWiki.polx
Content
... ... @@ -35,6 +35,10 @@
35 35  
36 36  It is also possible to perform transformations on the XML files. For example:
37 37  
38 +=== Insert a text value ===
39 +
40 +This can work well, for example, to change skin definitions. E.g.:
41 +
38 38  {{code language="xml"}}
39 39  <plugin>
40 40   <groupId>org.xwiki.commons</groupId>
... ... @@ -57,8 +57,10 @@
57 57  </plugin>
58 58  {{/code}}
59 59  
60 -{{info}}Since 9.5RC1{{/info}} it's possible to remove/replace/insert a complete XML element. Here is an example:
64 +=== Manipulate XML elements ===
61 61  
66 +{{info}}Since 9.5RC1{{/info}} it is possible to remove/replace/insert a complete XML element. Here is an example:
67 +
62 62  {{code language="xml"}}
63 63  <plugin>
64 64   <groupId>org.xwiki.commons</groupId>
... ... @@ -65,7 +65,8 @@
65 65   <artifactId>xwiki-commons-tool-xar-plugin</artifactId>
66 66   <configuration>
67 67   <transformations>
68 - <!-- Insert the content of file src/xar/transformations/ckeditor.xml as child of xwikidoc element in XWiki/XWikiPreferences.xml -->
74 + <!-- Insert the content of file src/xar/transformations/ckeditor.xml
75 + as child of xwikidoc element in XWiki/XWikiPreferences.xml -->
69 69   <transformation>
70 70   <artifact>org.xwiki.platform:xwiki-platform-distribution-ui-base</artifact>
71 71   <file>XWiki/XWikiPreferences.xml</file>
... ... @@ -84,6 +84,53 @@
84 84  </plugin>
85 85  {{/code}}
86 86  
94 +=== Insert Text Content of a File ===
95 +
96 +{{info}}Since 11.4RC1{{/info}} it is possible to insert the text of another project file. This works well to insert complex JavaScript, Velocity or CSS files. These files, if they are not named ##.xml## stay within the same directory and will be ignored unless they are inserted and can thus be edited with an integrated development environment (which brings syntax coloring, auto-completion, reformatting, or validation). Here is an example:
97 +
98 +{{code language="xml"}}
99 +<plugin>
100 + <groupId>org.xwiki.commons</groupId>
101 + <artifactId>xwiki-commons-tool-xar-plugin</artifactId>
102 + <configuration>
103 + <transformations>
104 + <transformation>
105 + <!-- Insert the content of file src/main/resources/MyApp/config.js
106 + as the value of the property code in the first object of class
107 + XWiki.JavaScriptExtension of the XML file MyApp/Config.xml -->
108 + <action>INSERT_TEXT</action>
109 + <file>MyApp/Config.xml</file>
110 + <xpath>/xwikidoc/object[className[text()='XWiki.JavaScriptExtension']]/property/code</xpath>
111 + <content>src/main/resources/MyApp/config.js</content>
112 + </transformation>
113 + </transformations>
114 + </configuration>
115 +</plugin>
116 +{{/code}}
117 +
118 +
119 +=== Insert an Attachment ===
120 +
121 +{{info}}Since 11.4RC1{{/info}} it is possible to insert the content of another project file as an attachment in Base64 encoding just as XWiki would do it in an XML file of a XAR. You can use this to insert files with the same name edited somewhere else. Doing so, it also updates the filesize attribute. Here is an example:
122 +
123 +{{code language="xml"}}
124 +<plugin>
125 + <groupId>org.xwiki.commons</groupId>
126 + <artifactId>xwiki-commons-tool-xar-plugin</artifactId>
127 + <configuration>
128 + <transformations>
129 + <transformation>
130 + <!-- Insert the content of file src/main/resources/MyApp/testcolors.xls
131 + as the attachment of the page TestDocumentList of the space MyApp -->
132 + <action>INSERT_ATTACHMENT_CONTENT</action>
133 + <file>MyApp/TestDocumentList.xml</file>
134 + <content>src/main/resources/MyApp/testcolors.xls</content>
135 + </transformation>
136 + </transformations>
137 + </configuration>
138 +</plugin>
139 +{{/code}}
140 +
87 87  == Documents types ==
88 88  
89 89  {{info}}

Get Connected