Setting up Your Maven Environment

Once you have Maven installed, either as part of a Fusion Middleware package, or from the Apache website, you need to perform a few initial steps to set up your environment.

How to Set Up Your Maven Environment

The first thing you need to do to use Maven is to set your environment variables.

To set up your environment on Unix:

  1. Add Maven to your operating system's PATH:

    • Update your shell startup script, your .profile or .bash_profile, to update the path. For example, if you have installed Oracle WebLogic Server in /u01/fmwhome and you are using the bash shell, then add the following to the PATH environment variable:

      export M2_HOME=/u01/fmwhome/oracle_common/modules/org.apache.maven_3.0.4

      export PATH=${M2_HOME}/bin:$PATH

  2. Set the JAVA_HOME environment variable to point to your JDK installation, for example, export JAVA_HOME=u01\jdk1.7.0

To set up your environment on Windows:

  1. Edit your PATH environment variable and add the correct Maven directory path at the beginning of the PATH environment variable. For example, if you have installed your Fusion Middleware in c:\fmwhome, then add the following:

    C:\fmwhome\oracle_common\modules\org.apache.maven_3.0.4\bin

  2. Set the JAVA_HOME environment variable to point to your JDK installation, for example, export JAVA_HOME=C:\Oracle\Middleware\jdk1.7.0

  3. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the Advanced tab, then the Environment Variables button. Add the M2_HOME variable in the user variables with the value C:\<ORACLE_HOME>\oracle_ common\modules\org.apache.maven_3.0.4\bin\. If you installed Maven from the Apache website, the value will be C:\Program Files\Apache Software Foundation\apache-maven-3.0.5.

  4. In the same dialog, add the user variable with the value %M2_HOME%\bin

  5. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.

  6. If you run into problems, check this helpful Apache page: https://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException.