How do I prevent including JARs in WEB-INF/lib? I need a "compile only" scope!

The scope you should use for this is provided. This indicates to Maven that the dependency will be provided at run time by its container or the JDK, for example.

Dependencies with this scope will not be passed on transitively, nor will they be bundled in an package such as a WAR, or included in the runtime classpath.

[top]

How do I list available plugins?

To see a list of available plugins, browse the Maven 2 plugin repository at http://www.ibiblio.org/maven2/plugins/. Plugins are organized according to a directory structure that resembles the standard Java package naming convention. To see a list of available plugins from the Maven project look in the org/apache/maven subfolder of this directory.

[top]

How do I determine what version of a plugin I am using?

You can use the Maven Help Plugin's describe goal. For example, to find out the version of the install plugin:

mvn -Dplugin=install help:describe

Note that you must give the plugin prefix as the argument to plugin, not it's artifact ID.

[top]

How can I use Ant tasks in Maven 2?

There are currently 2 alternatives:

[top]

How do I set up Maven so it will compile with a target and source JVM of my choice?

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 :

<build>
  ...
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5
1.5 ...
[top]

Is it possible to create my own directory structure?

Absolutely yes!

By configuring <sourceDirectory>, <resources> and other elements of the <build> section.

In addition, you may need to change the plugin configuration if you are not using plugin defaults for their files/directories.

[top]

Where is the source code? I couldn't seem to find a link anywhere on the Maven2 site.

The source code can be found in subversion: http://svn.apache.org/repos/asf/maven/components/trunk.

For more information, see Building Maven 2.0.

[top]

Maven can't seem to download the dependencies. Is my installation correct?

You most probably need to configure Maven to use a proxy. Please see the information on Configuring a proxy for information on how to configure your proxy for Maven.

[top]

I have a jar that I want to put into my local repository. How can I copy it in?

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.

m2 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
        

This should load in the file into the maven repository, renaming it as needed.

[top]

How do I unsubscribe from Maven mailing lists?
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 users@maven.apache.org then you would send a message to users-unsubscribe@maven.apache.org 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 ...
[top]

How to skip the tests
add the parameter -Dmaven.test.skip=true in the command line
[top]

Handle special characters in site

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

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <configuration>
    <outputEncoding>UTF-8</outputEncoding>
  </configuration>
</plugin>

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

[top]