1. How do I prevent including JARs in WEB-INF/lib? I need a "compile only" scope! 2. How do I list available plugins? 3. How do I determine what version of a plugin I am using? 4. How can I use Ant tasks in Maven 2? 5. How do I set up Maven so it will compile with a target and source JVM of my choice? 6. Is it possible to create my own directory structure? 7. Where is the source code? I couldn't seem to find a link anywhere on the Maven2 site. 8. Maven can't seem to download the dependencies. Is my installation correct? 9. I have a jar that I want to put into my local repository. How can I copy it in? 10. How do I unsubscribe from Maven mailing lists? 11. How to skip the tests 12. Handle special characters in site 13. How do I include tools.jar in my dependencies? 14. Why does Maven compile my test classes but don't run them? 15. Where are Maven SNAPSHOT artifacts? 16. Where are the Maven XSD schemas? 17. Maven doesn't work, how do I get help?
◎ For use in a plugin written in Java, Beanshell or other Java-like scripting language, you can construct the Ant tasks using the instructions given in the Ant documentation ◎ If you have very small amounts of Ant script specific to your project, you can use the AntRun plugin.
5.我如何设置Maven,使用我选择的JVM源码和目标?
You must configure the source and target parameters in your pom. For example, to set the source and target JVM to 1.5, you should have in your pom :
You most probably need to configure Maven to use a proxy. Please see the information on for information on how to configure your proxy for Maven.
9.我有一个jar,我想把它放在我自己本地仓库.我怎样把它拷贝进去?
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.
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.
mvn install:install-file
-Dfile=
-DgroupId=
-DartifactId=
-Dversion=
-Dpackaging=
-DgeneratePom=true
Where: the path to the file to load
the group that the file should be registered under
the artifact name for the file
the version of the file
the packaging of the file e.g. jar
mvn install:install-file -Dfile= -DgroupId= -DartifactId= -Dversion= -Dpackaging= -DgeneratePom=true Where: the path to the file to load the group that the file should be registered under the artifact name for the file the version of the file the packaging of the file e.g. jar This should load in the file into the maven repository, renaming it as needed.
10.我如何取消Maven邮件列表的订约?
To unsubscribe from a Maven mailing list you simply send a message to
[mailing-list]-unsubscribe@maven.apache.org
So, if you have subscribed to then you would send a message to 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.
If you find you still cannot get off a list then send a message to [mailing-list]-help@maven.apache.org. These instructions are also appended to every message sent out on a maven mailing list ...
11.我如何跳过测试 Add the parameter -Dmaven.test.skip=true in the command line
12.处理站点中特别字符
Configure your ide to use the correct encoding. With eclipse, add -Dfile.encoding=ISO-8859-1 in eclipse.ini file
Configure the output encoding in your pom
...
org.apache.maven.plugins
maven-site-plugin
UTF-8
lt;/plugin>
...
... org.apache.maven.pluginsmaven-site-pluginUTF-8 ... Configure the file encoding use by mvn. add to MAVEN_OPTS the encoding (same as the ide). This can be made with adding MAVEN_OPTS="-Dfile.encoding=ISO-8859-1" in $HOME/.profile
13.在我的依赖中如何包含tools.jar?
The following code includes tools.jar on Sun JDKs (it is already included in the runtime for Mac OS X and some free JDKs).
Tests are run by the surefire plugin. 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:
...
test
some-value
...
or
...
some-value
...
... testsome-value ... or ... some-value ...
15.Where are Maven SNAPSHOT artifacts?
If you are trying to build a development version of Maven or plugins, you may need to access the maven snapshot repositories.