@@ -28,17 +28,17 @@ Set Up The Classpath
28
28
* {Contents}
29
29
30
30
* {{{Add}Add A Class-Path Entry To The Manifest}}
31
-
31
+
32
32
* {{{Make}Make The Jar Executable}}
33
-
33
+
34
34
* {{{Prefix}Altering The Classpath: Defining a Classpath Directory Prefix}}
35
-
35
+
36
36
* {{{Repository}Altering The Classpath: Using a Maven Repository-Style Classpath}}
37
-
37
+
38
38
* {{{Custom}Altering The Classpath: Using a Custom Classpath Format}}
39
-
39
+
40
40
* {{{Snapshot}Handling Snapshot Versions}}
41
-
41
+
42
42
[]
43
43
44
44
* {Add} A Class-Path Entry To The Manifest
@@ -90,7 +90,6 @@ Set Up The Classpath
90
90
+-----+
91
91
Manifest-Version: 1.0
92
92
Created-By: Apache Maven ${maven.version}
93
- Built-By: ${user.name}
94
93
Build-Jdk: ${java.version}
95
94
Class-Path: plexus-utils-1.1.jar commons-lang-2.1.jar
96
95
+-----+
@@ -149,7 +148,6 @@ Class-Path: plexus-utils-1.1.jar commons-lang-2.1.jar
149
148
+-----+
150
149
Manifest-Version: 1.0
151
150
Created-By: Apache Maven ${maven.version}
152
- Built-By: ${user.name}
153
151
Build-Jdk: ${java.version}
154
152
Main-Class: fully.qualified.MainClass
155
153
Class-Path: plexus-utils-1.1.jar commons-lang-2.1.jar
@@ -213,7 +211,7 @@ Class-Path: lib/plexus-utils-1.1.jar lib/commons-lang-2.1.jar
213
211
214
212
Occasionally, you may want to include a Maven repository-style directory structure in your
215
213
archive. If you wish to reference the dependency archives within those directories in your
216
- manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
214
+ manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
217
215
<<<'repository'>>>, like this:
218
216
219
217
+-----+
@@ -230,7 +228,7 @@ Class-Path: lib/plexus-utils-1.1.jar lib/commons-lang-2.1.jar
230
228
<addClasspath>true</addClasspath>
231
229
<classpathPrefix>lib/</classpathPrefix>
232
230
<classpathLayoutType>repository</classpathLayoutType>
233
-
231
+
234
232
<!-- NOTE: Deprecated in version 2.4. Use 'classpathLayoutType' instead.
235
233
<classpathMavenRepositoryLayout>true</classpathMavenRepositoryLayout>
236
234
-->
@@ -258,7 +256,7 @@ Class-Path: lib/plexus-utils-1.1.jar lib/commons-lang-2.1.jar
258
256
+-----+
259
257
260
258
<<Note:>> In version 2.3, this feature was available by setting the <<<\<classpathMavenRepositoryLayout\>>>>
261
- element to the value <<<true>>>. This configuration option has been *deprecated* in version 2.4,
259
+ element to the value <<<true>>>. This configuration option has been *deprecated* in version 2.4,
262
260
in favor of the more general <<<\<classpathLayoutType\>>>> element, where a value of <<<'repository'>>>
263
261
will render the same behavior.
264
262
@@ -276,7 +274,7 @@ Class-Path: lib/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar lib/co
276
274
277
275
At times, you may have dependency archives in a custom format within your own archive, one that doesn't
278
276
conform to any of the above classpath layouts. If you wish to define a custom layout for dependency archives
279
- within your archive's manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
277
+ within your archive's manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
280
278
<<<'custom'>>>, along with the <<<\<customClasspathLayout\>>>> element, like this:
281
279
282
280
+-----+
@@ -315,35 +313,35 @@ Class-Path: lib/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar lib/co
315
313
</project>
316
314
+-----+
317
315
318
- This classpath layout is a little more involved than the previous examples.
316
+ This classpath layout is a little more involved than the previous examples.
319
317
To understand how the value of the <<<\<customClasspathLayout\>>>> configuration
320
- is interpreted, it's useful to understand the rules applied when resolving
318
+ is interpreted, it's useful to understand the rules applied when resolving
321
319
expressions within the value:
322
-
320
+
323
321
[[1]] If present, trim off the prefix 'artifact.' from the expression.
324
-
325
- [[2]] Attempt to resolve the expression as a reference to the Artifact using
326
- reflection (eg. <<<'artifactId'>>> becomes a reference to the method
322
+
323
+ [[2]] Attempt to resolve the expression as a reference to the Artifact using
324
+ reflection (eg. <<<'artifactId'>>> becomes a reference to the method
327
325
<<<'getArtifactId()'>>>).
328
-
329
- [[3]] Attempt to resolve the expression as a reference to the ArtifactHandler of
326
+
327
+ [[3]] Attempt to resolve the expression as a reference to the ArtifactHandler of
330
328
the current Artifact, again using reflection (eg. <<<'extension'>>> becomes a reference
331
329
to the method <<<'getExtension()'>>>).
332
-
333
- [[4]] Attempt to resolve the expression as a key in the special-case Properties instance,
330
+
331
+ [[4]] Attempt to resolve the expression as a key in the special-case Properties instance,
334
332
which contains the following mappings:
335
-
336
- * <<<'dashClassifier'>>>: If the Artifact has a classifier, this will be
337
- <<<'-${artifact.classifier}'>>>, otherwise this
333
+
334
+ * <<<'dashClassifier'>>>: If the Artifact has a classifier, this will be
335
+ <<<'-${artifact.classifier}'>>>, otherwise this
338
336
is an empty string.
339
-
337
+
340
338
* <<<'dashClassifier?'>>>: This is a synonym of <<<'dashClassifier'>>>.
341
-
342
- * <<<'groupIdPath'>>>: This is the equivalent of <<<'${artifact.groupId}'>>>,
339
+
340
+ * <<<'groupIdPath'>>>: This is the equivalent of <<<'${artifact.groupId}'>>>,
343
341
with all <<<'.'>>> characters replaced by <<<'/'>>>.
344
-
342
+
345
343
[]
346
-
344
+
347
345
[]
348
346
349
347
The manifest classpath produced using the above configuration would look like this:
@@ -359,18 +357,18 @@ Class-Path: WEB-INF/lib/org/codehaus/plexus/plexus-utils-1.1.jar WEB-INF/lib/com
359
357
360
358
<(Since 2.4)>
361
359
362
- Depending on how you construct your archive, you may have the ability to specify whether
360
+ Depending on how you construct your archive, you may have the ability to specify whether
363
361
snapshot dependency archives are included with the version suffix <<<'-SNAPSHOT'>>>, or
364
362
whether the unique timestamp and build-number for that archive is used. For instance,
365
363
the {{{/plugins/maven-assembly-plugin}Assembly Plugin}} allows
366
- you to make this decision in the <<<\<outputFileNameMapping\>>>> element of its
364
+ you to make this decision in the <<<\<outputFileNameMapping\>>>> element of its
367
365
<<<\<dependencySet>>>> descriptor section.
368
-
366
+
369
367
** Forcing the use of -SNAPSHOT versions when using the simple (default) or repository classpath layout
370
368
371
369
To force the use of <<<'-SNAPSHOT'>>> version naming, simply disable the <<<\<useUniqueVersions\>>>>
372
370
configuration element, like this:
373
-
371
+
374
372
+-----+
375
373
<useUniqueVersions>false</useUniqueVersions>
376
374
+-----+
@@ -379,13 +377,13 @@ Class-Path: WEB-INF/lib/org/codehaus/plexus/plexus-utils-1.1.jar WEB-INF/lib/com
379
377
380
378
To force the use of <<<'-SNAPSHOT'>>> version naming, simply replace <<<'${artifact.version}'>>>
381
379
with <<<'${artifact.baseVersion}'>>> in the custom layout example above, so it looks like this:
382
-
380
+
383
381
+-----+
384
382
<customClasspathLayout>WEB-INF/lib/${artifact.groupIdPath}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</customClasspathLayout>
385
383
+-----+
386
384
387
385
The full example configuration would look like this:
388
-
386
+
389
387
+-----+
390
388
<project>
391
389
...
0 commit comments