General What is Maven? Please see the Objectives and Features documents. Where do I get help on Maven?

This FAQ answers some frequent questions already, please read the Getting Started for a quick start guide.

The Reference section contain a comprehensive user guide and documentation about the various plugins that exist for maven.

If these resources don't help you with your problem, the Maven User List is a good source for help. Lots of problems have already been discussed there, you'll probably find a solution in the mailling list archive. Most of the maven developers are subscribed to the Maven User List.

Maven developers meet via IRC: irc.codehaus.org:6667, channel #maven But please don't ask for solutions to maven problems there, as maven user problems should be discussed at the mailing list for several good reasons (e.g. mail archive, more subscribers) and usually you get a quick answer on the mailing list.

What does Maven mean? A maven (yi.=meyvn) is an experienced or knowledgeable person, such as an expert or freak.
Using Maven How do I find help on a specific goal?

All Maven goals are provided by plugins. For example, the goals jar and jar:install are provided by the jar plugin. You can find a list of plugins and there documentation here.

What's the problem with entities in project.xml?

As of Maven 1.1, external entities will not be supported by default in project.xml, and their use is discouraged in Maven 1.0.x as well.

There are several reasons for this, but the main reason is that the content of project.xml needs to be completely self-contained and and able to be reproduced from a history at any point in time.

For this reason, using jelly expressions other than pom references is also not recommended and likely to be unsupported in future.

The most common use of this technique is to manage dependencies across multiple projects. There is unfortunately no other better solutions in the current version of Maven other than copying the dependencies. See transitive dependencies for more information.

Note: special character entities will always be supported and should not have any current issues.

How do I use Maven with xdoclet? The xdoclet plugin is provided by the xdoclet developers. All questions about it should be directed to the xdoclet mailing lists. Maven takes a long time to load. Is there anyway to speed things ? You can use the Console Plugin to get an interactive shell that will let load Maven once and run as many goals as you want. On average machines it takes something like ten seconds to compile and run unit tests, so that you can build often and test your code often. Why is the Maven repository on Ibiblio and not at Apache? There are several reasons why the Maven Repository was setup at Ibiblio. Ibiblio is a massive archive of almost everything you could imagine but one of the stated goals of Ibiblio is to "Expand and improve the distribution of open source software". There is really no limit to how much we can stuff in the repository at Ibiblio and it will be archived indefinitely. They have a lot of bandwith, good redundancy and have a very secure setup. Another reason we placed the repository there was that it is Apache policy not to store any (L)GPL artifacts on our servers. We wanted Maven to work for as many Java developers as possible so we chose Ibiblio where there is no restriction on store (L)GPL artifacts. You can find out more about Ibiblio here. How do I upload a resource to or update a resource on http://www.ibiblio.org/maven? Read Uploading to Ibiblio Instructions. Are there any mirrors for the Maven repository at ibiblio? Yes, there are at least the following:
  • http://www.ibiblio.org/maven/
  • http://planetmirror.com/pub/maven/
  • http://mirrors.sunsite.dk/maven/
  • http://ftp.up.ac.za/pub/linux/maven/
  • http://download.au.kde.org/pub/maven/
How do I share my Maven plugin with others? Read Sharing Your Plugins. How do I make my build complete even with broken tests? See the Test Plugin Reference. Most notably, maven.test.skip and maven.test.failure.ignore. Heed the warnings! Where does the output from my JUnit tests go? If you are running test:test, the exceptions will usually be output to ./target/test-reports/some.package.SomeClassTest.txt. If you want to see the errors in the output, set the property maven.junit.usefile to false. How do I provide multiple source directories in my project.xml?

You can't. However, if you really need it, you can use a snippet in maven.xml:

]]>

Please think about the reason you need this, and carefully consider whether it is necessary. Usually this is used for writing plugins that handle source generation.

How do I spin off a background process in a goal?

For example, before starting unit tests you might need to start a DB server. The DB server blocks until it is terminated, so it needs to be started in the background. <ant:parallel> does not seem to work in this case because it blocks the main execution thread, which is exactly what needs to be avoided.

The solution is given in this thread.

How do I download a new plugin? maven -DartifactId=artifactID -DgroupId=GROUPID -Dversion=VERSION plugin:download How do I share build code between projects?

Write your own maven plugin. It's not as difficult as you may think it is, and it will probably save you much time when your code grows in size.

Documentation on how to write plugins is available here.

It can also be helpful to refer to the source code for the existing Maven plugins which you already have installed.

Do I need to specify all the dependencies in the POM? The short answer is YES. Maven 2 will have a transitive dependency discovery mechanism that will avoid this.
Building Maven How do I build Maven? Please see the Bootstrapping document. How do I build Maven from behind a firewall? You typically need to set your HTTP proxy host and port details so that Maven can tunnel through your HTTP Proxy. To do this you typically need to set the maven.proxy.host and maven.proxy.port properties. See the User Guide for more details. Jelly Usage How do I get or set plugin properties from Jelly?

Plugin properties can be used with the following tags: maven:get and maven:set. (These replace the deprecated versions of ${pom.getPluginContext(...).get/setVariable()} and maven:pluginVar.)

Example:

The WAR source directory is ${warSourceDir} ... ]]>
Troubleshooting Maven Why do the unit tests fail under Java 1.4? It is possible that the XML parser included with Ant is interfering with the XML parser included in Java 1.4. Please set the ${maven.junit.fork} property to yes. Why does change log ask me to check out the source code? When you run the cvs change log report in maven, you may see an error occasionally, such as:

cvs [log aborted]: there is no version here; do 'cvs checkout' first
ChangeLog found: 5 entries

This is caused by the cvs log command finding a directory in it's repository that you don't have locally. Note: The directory may not appear on a checkout or update if it is empty in the repository. Please do a clean checkout of the code and retry the report.
I have problems generating the changelog report. Why?

When you run the cvs change log report in maven, the report hangs or the final output is blank.

This is typically caused by the cvs command not running correctly. The first port of call is to check maven's output, search the lines containing for "SCM".

Try running the command that you find in the log file manually. The results typically speak for themselves.

How do I get the XSLT tasks to work?

A common symptom is that the Jelly or Ant tag are output instead of being processed. See MAVEN-156.

The solution is to add the JAXP system property via the Jelly script.

]]>

Also make sure that Xalan is declared as dependencies in your project file:

xalan xalan 2.3.1 http://xml.apache.org/xalan/ root ]]>
maven site fails with bizarre Jelly errors, what can I do? When I try to generate my site I get something like this: Invalid source argument. Must be a String, Reader, InputStream or URL. Was type; java.io.File with value: /home/jvanzyl/js/com.werken/drools/target/jdepend-raw-report.xml Total time: 12 seconds ]]>

This problem has been observed when a version of Jelly used as a dependency is different than the one distributed with Maven. This is the version of Jelly that is distributed with Maven 1.0-rc2. If you align your versions of Jelly you should be able to generate your site. We hope to alleviate these problems with real ClassLoader isolation using Classworlds.

Recent Changes (Migrating from older versions of Maven) Why are strange property values appearing from other parts of my project?

Early in RC3, the bug that caused project.properties file inheritance to fail was fixed. This means that if you extend another project.xml file, you also inherit the project.properties and build.properties files from the same directory.

While this was a highly demanded fix, some builds may have come to depend on it not working (including the Maven build itself!). This is usually due to having a master build project that also serves as a base project extended by a set of subprojects, and wanting the properties to apply to the master, but not to the subprojects.

We recommend that you separate these concerns by having both a master build project and a parent project for extension (see the maven-plugins CVS tree for an example).

However, should you need to maintain your old structure, and you are encountering these problems, you can add the following property to stop parents from being inherited:

maven.property.inheritance=false
Why shouldn't I use the dependency classloader override property?

Because it isn't needed. root.maven is equivalent to the project classloader. While root is the Ant classloader, you should not load tasks into it as it will then force itself on the other plugins executed afterwards. In particular any jakarta-commons libraries should not be in the root classloader as these can clash with Jelly.

The correct way to use ant tasks in maven.xml or a plugin is something like:

]]>
What happened to maven.log?

It has been removed from log4j.properties. It was always created in the directory Maven was run from, and only repeated what was on the console in most cases, which was quite annoying. You can now get all the debugging information you need and more by using the -X flag to maven.

Of course, if you would like to write certain information to a file and piping is not an option or you want greater control over what is controlled, you can override the log4j configuration. Refer to the log4j documentation for how to override this using system properties.