• Document Up to Date
  • Updated On 4.0.0
orphan:

Dependency Resolver Configuration

Crafter Studio extracts and tracks dependencies between content items to assist authors with publishing, workflow and core content operations like copy and delete. This file configures what file paths Crafter considers a dependency and how they should be extracted.

To modify the Dependency Resolver configuration, click on projectTools from the bottom of the Sidebar, then click on Configuration and select Dependency Resolver from the dropdown list.

Configurations - Open Dependency Resolver Configuration

Sample

Here’s a sample Dependency Resolver Configuration file (click on the triangle on the left to expand/collapse):

Sample dependency resolver configuration
CRAFTER_HOME/data/repos/sites/SITENAME/sandbox/config/studio/dependency/resolver-config.xml
  1<?xml version="1.0" encoding="UTF-8"?>
  2<!--
  3  ~ Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
  4  ~
  5  ~ This program is free software: you can redistribute it and/or modify
  6  ~ it under the terms of the GNU General Public License version 3 as published by
  7  ~ the Free Software Foundation.
  8  ~
  9  ~ This program is distributed in the hope that it will be useful,
 10  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  ~ GNU General Public License for more details.
 13  ~
 14  ~ You should have received a copy of the GNU General Public License
 15  ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 16  -->
 17
 18<!-- resolver-config.xml
 19
 20    This file configures what file paths Crafter considers a dependency and how they should be extracted 
 21
 22-->
 23
 24<dependency-resolver>
 25    <item-types>
 26        <item-type>
 27            <!-- name of type -->
 28            <name>page</name>
 29            <!-- how to identify items of this type -->
 30            <includes>
 31                <!-- path pattern regexes (multiple) -->
 32                <path-pattern>/site/website/.*\.xml</path-pattern>
 33            </includes>
 34            <!-- how to find dependencies in these items -->
 35            <dependency-types>
 36                <dependency-type>
 37                    <name>page</name>
 38                    <includes>
 39                        <pattern>
 40                            <find-regex>/site/website/([^&lt;]+)\.xml</find-regex>
 41                        </pattern>
 42                    </includes>
 43                </dependency-type>
 44                <dependency-type>
 45                    <name>component</name>
 46                    <includes>
 47                        <pattern>
 48                            <find-regex>/site/components/([^&lt;]+)\.xml</find-regex>
 49                        </pattern>
 50                    </includes>
 51                </dependency-type>
 52				<dependency-type>
 53                    <name>item</name>
 54                    <includes>
 55                        <pattern>
 56                            <find-regex>/site/(?!website/|components/)([^&lt;]+)\.xml</find-regex>
 57                        </pattern>
 58                    </includes>
 59                </dependency-type>
 60                <dependency-type>
 61                    <name>asset</name>
 62                    <includes>
 63                        <!-- path patterns to look for (multiple) -->
 64                        <pattern>
 65                            <find-regex>/static-assets/([^&lt;"'\)\?\#]+)</find-regex>
 66                        </pattern>
 67                    </includes>
 68                </dependency-type>
 69                <dependency-type>
 70                    <name>rendering-template</name>
 71                    <includes>
 72                        <pattern>
 73                            <find-regex>/templates/([^&lt;"]+)\.ftl</find-regex>
 74                        </pattern>
 75                    </includes>
 76                </dependency-type>
 77                <dependency-type>
 78                    <name>script</name>
 79                    <includes>
 80                        <pattern>
 81                            <find-regex>/scripts/([^&lt;"]+)\.groovy</find-regex>
 82                        </pattern>
 83                        <pattern>
 84                            <find-regex>&lt;content-type&gt;/(.*)/(.*)&lt;/content-type&gt;</find-regex>
 85                            <transforms>
 86                                <transform>
 87                                    <match>&lt;content-type&gt;/(.*)/(.*)&lt;/content-type&gt;</match>
 88                                    <replace>/scripts/$1s/$2.groovy</replace>
 89                                </transform>
 90                            </transforms>
 91                        </pattern>
 92                    </includes>
 93                </dependency-type>
 94            </dependency-types>
 95        </item-type>
 96        <item-type>
 97            <!-- name of type -->
 98            <name>component</name>
 99            <!-- how to identify items of this type -->
100            <includes>
101                <!-- path pattern regexes (multiple) -->
102                <path-pattern>/site/components/([^&lt;]+)\.xml</path-pattern>
103            </includes>
104            <!-- how to find dependencies in these items -->
105            <dependency-types>
106                <dependency-type>
107                    <name>page</name>
108                    <includes>
109                        <pattern>
110                            <find-regex>/site/website/([^&lt;]+)\.xml</find-regex>
111                        </pattern>
112                    </includes>
113                </dependency-type>
114                <dependency-type>
115                    <name>component</name>
116                    <includes>
117                        <pattern>
118                            <find-regex>/site/components/([^&lt;]+)\.xml</find-regex>
119                        </pattern>
120                    </includes>
121                </dependency-type>
122				<dependency-type>
123                    <name>item</name>
124                    <includes>
125                        <pattern>
126                            <find-regex>/site/(?!website/|components/)([^&lt;]+)\.xml</find-regex>
127                        </pattern>
128                    </includes>
129                </dependency-type>
130                <dependency-type>
131                    <name>asset</name>
132                    <includes>
133                        <pattern>
134                            <find-regex>/static-assets/([^&lt;"'\)\?\#]+)</find-regex>
135                        </pattern>
136                    </includes>
137                </dependency-type>
138                <dependency-type>
139                    <name>rendering-template</name>
140                    <includes>
141                        <pattern>
142                            <find-regex>/templates/([^&lt;"]+)\.ftl</find-regex>
143                        </pattern>
144                    </includes>
145                </dependency-type>
146                <dependency-type>
147                    <name>script</name>
148                    <includes>
149                        <pattern>
150                            <find-regex>/scripts/([^&lt;"]+)\.groovy</find-regex>
151                        </pattern>
152                        <pattern>
153                            <find-regex>&lt;content-type&gt;/(.*)/(.*)&lt;/content-type&gt;</find-regex>
154                            <transforms>
155                                <transform>
156                                    <match>&lt;content-type&gt;/(.*)/(.*)&lt;/content-type&gt;</match>
157                                    <replace>/scripts/$1s/$2.groovy</replace>
158                                </transform>
159                            </transforms>
160                        </pattern>
161                    </includes>
162                </dependency-type>
163            </dependency-types>
164        </item-type>
165		<item-type>
166            <!-- an item is content that is not a page nor a component -->
167            <name>item</name>
168            <!-- how to identify items of this type -->
169            <includes>
170                <!-- path pattern regexes (multiple) -->
171                <path-pattern>/site/(?!website/|components/).*\.xml</path-pattern>
172            </includes>
173            <!-- how to find dependencies in these items -->
174            <dependency-types>
175                <dependency-type>
176                    <name>page</name>
177                    <includes>
178                        <pattern>
179                            <find-regex>/site/website/([^&lt;]+)\.xml</find-regex>
180                        </pattern>
181                    </includes>
182                </dependency-type>
183				<dependency-type>
184                    <name>item</name>
185                    <includes>
186                        <pattern>
187                            <find-regex>/site/(?!website/|components/)([^&lt;]+)\.xml</find-regex>
188                        </pattern>
189                    </includes>
190                </dependency-type>
191                <dependency-type>
192                    <name>component</name>
193                    <includes>
194                        <pattern>
195                            <find-regex>/site/components/([^&lt;]+)\.xml</find-regex>
196                        </pattern>
197                    </includes>
198                </dependency-type>
199				<dependency-type>
200                    <name>item</name>
201                    <includes>
202                        <pattern>
203                            <find-regex>/site/(?!website/|components/)([^&lt;]+)\.xml</find-regex>
204                        </pattern>
205                    </includes>
206                </dependency-type>
207                <dependency-type>
208                    <name>asset</name>
209                    <includes>
210                        <pattern>
211                            <find-regex>/static-assets/([^&lt;"'\)\?\#]+)</find-regex>
212                        </pattern>
213                    </includes>
214                </dependency-type>
215                <dependency-type>
216                    <name>rendering-template</name>
217                    <includes>
218                        <pattern>
219                            <find-regex>/templates/([^&lt;"]+)\.ftl</find-regex>
220                        </pattern>
221                    </includes>
222                </dependency-type>
223                <dependency-type>
224                    <name>script</name>
225                    <includes>
226                        <pattern>
227                            <find-regex>/scripts/([^&lt;"]+)\.groovy</find-regex>
228                        </pattern>
229                        <pattern>
230                            <find-regex>&lt;content-type&gt;/(.*)/(.*)&lt;/content-type&gt;</find-regex>
231                            <transforms>
232                                <transform>
233                                    <match>&lt;content-type&gt;/(.*)/(.*)&lt;/content-type&gt;</match>
234                                    <replace>/scripts/$1s/$2.groovy</replace>
235                                </transform>
236                            </transforms>
237                        </pattern>
238                    </includes>
239                </dependency-type>
240            </dependency-types>
241        </item-type>
242        <item-type>
243            <!-- name of type -->
244            <name>asset</name>
245            <!-- how to identify items of this type -->
246            <includes>
247                <!-- path pattern regexes (multiple) -->
248				<!-- include only textual files that can be scanned -->
249				<path-pattern>/static-assets/([^&lt;"'\)]+)\.css</path-pattern>
250				<path-pattern>/static-assets/([^&lt;"'\)]+)\.js</path-pattern>
251				<path-pattern>/static-assets/([^&lt;"'\)]+)\.html</path-pattern>
252				<path-pattern>/static-assets/([^&lt;"'\)]+)\.xml</path-pattern>
253				<path-pattern>/static-assets/([^&lt;"'\)]+)\.json</path-pattern>
254				<path-pattern>/static-assets/([^&lt;"'\)]+)\.scss</path-pattern>
255				<path-pattern>/static-assets/([^&lt;"'\)]+)\.sass</path-pattern>
256				<path-pattern>/static-assets/([^&lt;"'\)]+)\.hbs</path-pattern>
257            </includes>
258            <!-- how to find dependencies in these items -->
259            <dependency-types>
260                <dependency-type>
261                    <name>asset</name>
262                    <includes>
263                        <!-- path patterns to look for (multiple) -->
264                        <pattern>
265                            <find-regex>/static-assets/([^&lt;"'\)\?\#]+)</find-regex>
266                        </pattern>
267                    </includes>
268                </dependency-type>
269            </dependency-types>
270        </item-type>
271        <item-type>
272            <!-- name of type -->
273            <name>rendering-template</name>
274            <!-- how to identify items of this type -->
275            <includes>
276                <!-- path pattern regexes (multiple) -->
277                <path-pattern>/templates/([^&lt;"]+)\.ftl</path-pattern>
278            </includes>
279            <!-- how to find dependencies in these items -->
280            <dependency-types>
281                <dependency-type>
282                    <name>asset</name>
283                    <includes>
284                        <!-- path patterns to look for (multiple) -->
285                        <pattern>
286                            <find-regex>/static-assets/([^&lt;"'\)\?\#]+)</find-regex>
287                        </pattern>
288                    </includes>
289                </dependency-type>
290                <dependency-type>
291                    <name>rendering-template</name>
292                    <includes>
293                        <pattern>
294                        	<find-regex>/templates/([^&lt;"]+)\.ftl</find-regex>
295						</pattern>
296                    </includes>
297                </dependency-type>
298            </dependency-types>
299        </item-type>
300        <item-type>
301            <!-- name of type -->
302            <name>script</name>
303            <!-- how to identify items of this type -->
304            <includes>
305                <!-- path pattern regexes (multiple) -->
306                <path-pattern>/scripts/([^&lt;"]+)\.groovy</path-pattern>
307            </includes>
308            <!-- how to find dependencies in these items -->
309            <dependency-types>
310                <dependency-type>
311                    <name>script</name>
312                    <includes>
313                        <!-- path patterns to look for (multiple) -->
314                        <pattern>
315                            <find-regex>import scripts.(.*)</find-regex>
316                            <transforms>
317                                <transform>
318                                    <match>(.*)</match>
319                                    <replace>$1</replace>
320                                </transform>
321                            </transforms>
322                        </pattern>
323                    </includes>
324                </dependency-type>
325            </dependency-types>
326        </item-type>
327    </item-types>
328</dependency-resolver>