-
Notifications
You must be signed in to change notification settings - Fork 239
/
general.fml
439 lines (409 loc) · 15.6 KB
/
general.fml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<faqs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/FML/1.0"
xsi:schemaLocation="http://maven.apache.org/FML/1.0 https://maven.apache.org/xsd/fml-1.0.xsd"
title="Frequently Asked Technical Questions">
<part id="faq">
<faq id="encoding-warning">
<question>How do I prevent "[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!"</question>
<answer>
<p>
This or a similar warning is emitted by a plugin that processes plain text files but has not been configured to
use a specific file encoding. So eliminating the warning is simply a matter of finding out which plugin emits it
and how to configure the file encoding for it. This is as easy as adding the following property to
your POM (or one of its parent POMs):
</p>
<source><![CDATA[<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
</project>]]></source>
</answer>
</faq>
<faq id="scope-provided">
<question>How do I prevent including JARs in WEB-INF/lib? I need a "compile only" scope!</question>
<answer>
<p>
The scope you should use for this is
<code>provided</code>. This indicates to Maven that the dependency will be
provided at run time by its container or the JDK, for example.
</p>
<p>
Dependencies with this scope will not be passed on transitively, nor will they be bundled in a package such
as a WAR, or included in the runtime classpath.
</p>
</answer>
</faq>
<faq id="available-plugins">
<question>How do I list available plugins?</question>
<answer>
<p>
The "Available Plugins" page lists them and provides additional information.
See <a href="/plugins/">https://maven.apache.org/plugins</a>
</p>
</answer>
</faq>
<faq id="plugin-version">
<question>How do I determine what version of a plugin I am using?</question>
<answer>
<p>
You can use the <a href="/plugins/maven-help-plugin/">Maven Help Plugin</a>'s
<a href="/plugins/maven-help-plugin/describe-mojo.html"><code>describe</code></a> goal.
For example, to find out the version of the install plugin:
</p>
<code>mvn -Dplugin=install help:describe</code>
<p>
Note that you must give the plugin prefix as the argument to plugin, not it's artifact ID.
</p>
</answer>
</faq>
<faq id="using-ant-tasks">
<question>How can I use Ant tasks in a Maven build?</question>
<answer>
<p>
There are currently 2 alternatives:
</p>
<ul>
<li>
For use in a plugin written in Java, Beanshell or other Java-like scripting language, you can construct
the Ant tasks using the
<a href="https://ant.apache.org/manual/antexternal.html">instructions given in the Ant
documentation</a>
</li>
<li>
If you have very small amounts of Ant script specific to your project, you can use the
<a href="/plugins/maven-antrun-plugin/index.html">AntRun plugin</a>.
</li>
</ul>
</answer>
</faq>
<faq id="maven-ant-tasks">
<question>How can I use Maven features in an Ant build?</question>
<answer>
<p>
The <a href="/ant-tasks/index.html">Maven Ant Tasks</a> allow many of the features of
Maven, such as dependency management and repository deployment, to be used in an Ant build.
</p>
</answer>
</faq>
<faq id="Compiling-Java-7">
<question>How do I set up Maven so it will compile with a target and source JVM of my choice?</question>
<answer>
<p>
You must configure the source and target parameters in your pom. For example, to set the source and
target JVM to 7, you should have in your pom:
</p>
<source><![CDATA[<project>
...
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
...
</project>]]></source>
<p>
Or if a parent pom overrides for compiler plugin default values and you can't fix it,
you'll have to explicitly force the values in the compiler plugin configuration:
</p>
<source><![CDATA[<project>
...
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>]]></source>
</answer>
</faq>
<faq id="dir-struct">
<question>Is it possible to create my own directory structure?</question>
<answer>
<p>
Absolutely yes!
</p>
<p>
By configuring <code><sourceDirectory></code>, <code><resources></code> and other elements of
the <code><build></code> section.
</p>
<p>
In addition, you may need to change the plugin configuration if you are
not using plugin defaults for their files/directories.
</p>
</answer>
</faq>
<faq id="m2-source-code">
<question>Where is the source code? I couldn't seem to find a link anywhere on the Maven site.</question>
<answer>
<p>
The source code can be found in <a href="scm.html">our Subversion and Git repositories</a>.
</p>
<p>
For more information, see <a href="/guides/development/guide-building-maven.html">Building Maven</a>.
</p>
</answer>
</faq>
<faq id="proxy-needed">
<question>Maven can't seem to download the dependencies. Is my installation correct?</question>
<answer>
<p>
You most probably need to configure Maven to use a proxy. Please see the information on
<a href="/guides/mini/guide-proxies.html">Configuring a proxy</a> for information on how to configure your proxy
for Maven.
</p>
</answer>
</faq>
<faq id="importing-jars">
<question>I have a jar that I want to put into my local repository. How can I copy it in?</question>
<answer>
<p>
If you understand the layout of the Maven repository, you can copy the jar directly into where it
is meant to go. Maven will find this file next time it is run.
</p>
<p>
If you are not confident about the layout of the Maven repository, then you can
adapt the following command to load in your jar file, all on one line.
</p>
<source><![CDATA[
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
Where: <path-to-file> the path to the file to load
<group-id> the group that the file should be registered under
<artifact-id> the artifact name for the file
<version> the version of the file
<packaging> the packaging of the file e.g. jar
]]></source>
<p>
This should load in the file into the Maven repository, renaming it as needed.
</p>
</answer>
</faq>
<faq id="unsubscribing-from-mailing-lists">
<question>How do I unsubscribe from Maven mailing lists?</question>
<answer>
<p>
To unsubscribe from a Maven mailing list you simply send a message to
<code>[mailing-list]-unsubscribe@maven.apache.org</code>
</p>
<p>
So, if you have subscribed to <code>users@maven.apache.org</code> then you would
send a message to <code>users-unsubscribe@maven.apache.org</code> in order to
get off the list.
People tend to have problems when they subscribe with one address and
attempt to unsubscribe with another. So make sure that you are using the
same address when unsubscribing that you used to subscribe before
asking for help.
</p>
<p>
If you find you still cannot get off a list then
send a message to <code>[mailing-list]-help@maven.apache.org</code>. These
instructions are also appended to every message sent out on a maven mailing
list ...
</p>
</answer>
</faq>
<faq id="skip-test">
<question>How do I skip the tests?</question>
<answer>
Add the parameter <code>-Dmaven.test.skip=true</code> or <code>-DskipTests=true</code> in the command line,
depending on whether you want to skip test compilation and execution or only execution. See the example
<a href="/plugins/maven-surefire-plugin/examples/skipping-tests.html">Skipping Tests</a>
in <a href="/plugins/maven-surefire-plugin/">the Surefire Plugin's documentation</a> for more details.
</answer>
</faq>
<faq id="run-one-test">
<question>How can I run a single unit test?</question>
<answer>
Use the parameter <code>-Dtest=MyTest</code> at the command line.
NB: do not specify the entire package (org.apache.x.y.MyTest)
</answer>
</faq>
<faq id="special-characters-site">
<question>Handle special characters in site</question>
<answer>
<p>Configure your ide to use the correct encoding. With Eclipse, add
<code>-Dfile.encoding=ISO-8859-1</code> in eclipse.ini file</p>
<p>Configure the reporting output encoding in your pom
<source><![CDATA[<project>
...
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
...
</project>]]></source>
or if default encoding is overridden in a parent pom that you can't change, configure the site plugin explicitly:
<source><![CDATA[<project>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.6</version>
<configuration>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
...
<project>]]></source>
</p>
<p>
Configure the file encoding use by mvn.
add to MAVEN_OPTS the encoding (same as the ide).
This can be made with adding <code>MAVEN_OPTS="-Dfile.encoding=ISO-8859-1"</code> in <code>$HOME/.profile</code>
</p>
</answer>
</faq>
<faq id="test-property-name">
<question>Maven compiles my test classes but doesn't run them?</question>
<answer>
<p>
Tests are run by <a href="/surefire/maven-surefire-plugin/">the surefire plugin</a>.
The surefire plugin can be configured to run certain test classes and
you may have unintentionally done so by specifying a value to ${test}.
Check your settings.xml and pom.xml for a property named "test" which would like this:
</p>
<source><![CDATA[<project>
...
<properties>
<property>
<name>test</name>
<value>some-value</value>
</property>
</properties>
...
</project>]]></source>
<p>
or
</p>
<source><![CDATA[<project>
...
<properties>
<test>some-value</test>
</properties>
...
</project>]]></source>
</answer>
</faq>
<faq id="snapshot-artifacts">
<question>Where are Maven SNAPSHOT artifacts?</question>
<answer>
<p>
If you are trying to build a development version of Maven or plugins,
you may need to access the Maven snapshot repositories.
</p>
<p>
You need to update your settings.xml file using the
<a href="/guides/development/guide-testing-development-plugins.html">
Guide to Plugin Snapshot Repositories</a>
</p>
</answer>
</faq>
<faq id="maven-xsd">
<question>Where are the Maven XSD schemas?</question>
<answer>
<p>
The Maven XSD is located <a href="/xsd/maven-4.0.0.xsd">here</a> and the Maven
Settings XSD is located <a href="/xsd/settings-1.0.0.xsd">here</a>.
</p>
<p>
Your favorite IDE probably supports XSD schema's for pom.xml and settings.xml editing. You need to
specify the following:
<source>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
...
</project></source>
<source>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
...
</settings></source>
</p>
</answer>
</faq>
<faq id="getting-help">
<question>Maven doesn't work, how do I get help?</question>
<answer>
<p>
We have compiled a list of available resources on the
<a href="/users/getting-help.html">getting help page</a>
</p>
</answer>
</faq>
<faq id="How_to_produce_execution_debug_output_or_error_messages">
<question>How to produce execution debug output or error messages?</question>
<answer>
<p>
You could call Maven with <i>-X</i> parameter or <i>-e</i> parameter. For more information,
run:
<code>mvn --help</code>
</p>
</answer>
</faq>
<faq id="What_is_a_Mojo">
<question>What is a Mojo?</question>
<answer>
<p>
A mojo is a <b>M</b>aven plain <b>O</b>ld <b>J</b>ava <b>O</b>bject. Each mojo is an executable
<i>goal</i> in Maven, and a Maven plugin is a distribution of one or more related mojos.
</p>
</answer>
</faq>
<faq id="How_to_find_dependencies">
<question>How to find dependencies on public Maven repositories?</question>
<answer>
<p>
You could use the following search engines:
</p>
<ul>
<li><a href="https://search.maven.org/">https://search.maven.org</a></li>
<li><a href="https://repository.apache.org">https://repository.apache.org</a></li>
<li><a href="https://mvnrepository.com">https://mvnrepository.com</a></li>
</ul>
</answer>
</faq>
<faq id="javadoc_jar_built_twice">
<question>Why is my Javadoc JAR built twice during release?</question>
<answer>
With MNG-5940 the release profile goal of the Maven Javadoc Plugin has been changed to <code>
jar-no-fork</code>. Revise your configuration to avoid duplicate JAR upload.
</answer>
</faq>
</part>
</faqs>