No results found

Your search did not match any results.

We suggest you try the following to help find what you’re looking for:

  • Check the spelling of your keyword search.
  • Use synonyms for the keyword you typed, for example, try “application” instead of “software.”
  • Try one of the popular searches shown below.
  • Start a new search.
Trending Questions

Working With Maven Projects In Oracle JDeveloper 11g

An Oracle JDeveloper How To Document
Written by Dana Singleterry, Oracle Corporation
Created June 2011

This document explains how-to work with Oracle JDeveloper 11g on Apache Maven-based projects. As an example I'll illustrate two possible scenarios. First I'll demonstrate importing a Apache Maven application from and then I'll demonstrate creating an application in Oracle JDeveloper 11g configured for using Apache Maven technologies. The new application will include a project that is preconfigured to use Maven technologies.


Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features

Maven is essentially a project management and comprehension tool and as such provides a way to help with managing:

  • Builds
  • Documentation
  • Reporting
  • Dependencies
  • SCMs
  • Releases
  • Distribution

For further details on what Maven is and isn't, please visit the Maven Getting Started Guide. The Feature Summary page provides the key features of Maven in a nutshell. Apache Maven Project documentation is available online.

Much of Maven's power comes from the standard practices it encourages. Time need not be wasted reinventing directory structures, conventions, and customized Ant build scripts for each project. Although you can override any particular directory location for your own specific needs, it's best to stick with the standard Maven 2 directory structure as much as possible, for several reasons:

  • It makes your POM file smaller and simpler
  • It makes the project easier to understand
  • It makes it easier to integrate plug-ins

The directory layout expected by Maven and the directory layout created by Maven follows. You should try to conform to this structure as much as possible; however, if you can't these settings can be overridden via the project descriptor.

src/main/java Application/Library sources
src/main/resources Application/Library resources
src/main/filters Resource filter files
src/main/assembly Assembly descriptiors
src/main/config Configuration files
src/main/webapp Web application sources
src/test/java Test sources
src/test/resources Test resources
src/test/filters Test resource filter files
src/site Site
LICENSE.txt Project's license
README.txt Project's readme

At the top level files descriptive of the project: a pom.xml file (and any properties, maven.xml or build.xml if using Ant). In addition, there are textual documents meant for the user to be able to read immediately on receiving the source: README.txt, LICENSE.txt, etc.

There are just two subdirectories of this structure: src and target. The only other directories that would be expected here are metadata like CVS or .svn, and any subprojects in a multiproject build (each of which would be laid out as above).

The target directory is used to house all output of the build.

The src directory contains all of the source material for building the project, its site and so on. It contains a subdirectory for each type: main for the main build artifact, test for the unit test code and resources, site and so on.

Within artifact producing source directories (ie. main and test), there is one directory for the language java (under which the normal package hierarchy exists), and one for resources (the structure which is copied to the target classpath given the default resource definition).

If there are other contributing sources to the artifact build, they would be under other subdirectories: for example src/main/antlr would contain Antlr grammar definition files.

Required Software

JDeveloper 11g (

Optional downloads

Apache Maven 2.2.1

Java JDK 1.6

Note that Apache Maven 2.2.1 comes with JDeveloper 11g via the extensions download. Java JDK1.6 is also indcluded with JDeveloper 11g. Both of these can still be downloaded separately and utilized independent of Oracle JDeveloper 11g.

Downloading and Installing JDeveloper 11g, Java JDK 1.6 & Maven 2.2.1

Download JDeveloper 11g and run the installer. Select the options that best fits your requirements for your development environment. Under most circumstances you will simply go with the defaults. Upon first running JDeveloper, select NO if prompted to migrate from previous versions. In addition, select the Default Role upon startup. Once you'vedownloaded and started JDeveloper 11g you're ready to begin as you no longer need to download and install the Maven extensions for JDeveloper as Maven is NOW part of the JDeveloper package.


Download Java JDK 1.6 and run the installer.

Download the appropriate Maven 2.2.1 distribution and install as follows for Windows 2000/XP:

Windows 2000/XP

  1. Unzip the distribution archive, i.e. to the directory you wish to install Maven 2.2.1. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-2.2.1 will be created from the archive.
  2. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-2.2.1. Be sure to omit any quotation marks around the path even if it contains spaces.
  3. In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin.
  4. Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.
  5. In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven to the path.
  6. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.6.0_25 and that %JAVA_HOME%\bin is in your Path environment variable.
  7. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.

Validate Maven Installation

Validate Maven Installation: Run mvn --version.

Note: For optional installation settings/configuration please visit the Apache Maven installation page.

Import a Maven Application into JDeveloper

The first thing to do is run the Maven Archetype create to create a project with the proper directory structure and a pom.xml. I'll create a project directory, mvnProjects, to run this in.

mvn archetype:create -DartifactId=my-app

Create Archetype 

Create Archetype.

You will notice that the create goal created a directory with the same name given as the artifactId. The pom.xml file is the core of a project's configuration in Maven. It is a single configuration file that contains the majority of information required to build a project in just the way you want.

                        <project xmlns="" xmlns:xsi=""


For details of what you just did please refer to the Maven Users Centre  The 5 minute test .

In the rest of the steps of this section I'll demonstrate Maven integration within JDeveloper 11g. 

  1. Create a new application workspace to import your Maven Project into. Note that it doesn't have to be a Custom Application since when you import the Maven Project, it will be configured accordingly.
  2. Create Application Workspace

    Create Application Workspace.

  3. Provide an Application Name nd Application Package Prefix.
  4. Create Workspace

    Provide an Application Name and select Finish. Note a default project will be created for you.

  5. Select File | Import from the JDeveloper Menu.
  6. Import Application 


  7. Select what you want to import. In this case "Maven Project".
  8. Maven Project 

    Select "Maven Project".

  9. Provide a the Root Directory for your Maven Projects, select the project(s) you want to import, and select the checkbox Copy project(s) in application. Select OK.
  10. Browse for Maven Application 

    Select Maven Project(s) to import.

  11. Review the imported Maven project..
  12. Review project 

    Review imported Maven project..

  13. Right select the pom.xml file and select "Manage Goals". Notice that you can also Manage Apache Maven Settings which you can also do from Project Properties as illustrated below.
  14. Manage Goals 

    Manage Goals.

  15. Shuttle additional Goals from Available to Selected so that the options are available from context upon choosing to run goals when right-selecting on the pom.xml and seleting the goal of your choice from context.
  16. Maven Project Properties 

    Maven: Goals.

  17. Optional Maven Configuration.
    • Here you can Customize your Maven Setting, Specify your Maven Version, Add Proxy to Settings if you're behind a firewall and more.

    Maven Project Properties 

    Maven Project Properties.

    • Here you can customize the Maven Process as needed. Add Java Options, change the Java SE Version, specify the Working Directory and more.

    Maven Project Properties 

    Maven: Process.

    • Here you can specify additional Maven Settings and customize as needed. Review the available options.

    Maven Project Properties 

    Maven: Settings.

  18. Right select the pom.xml and select Run Goal(s) from context. Choose the goal that you would like to run. For detailed information on the various goals please refer to the Apache Maven Build Lifecycle Page.
  19. Run Goals 

    Run the Goal of your choice.

  20. Run the package goal to take the compiled code and package it in its distributable format, sucha as a JAR.
  21. Run package goal 

    Run the package goal.

  22. Ensure the build is successful as illustrated below.
  23. Package goal results 

    Review the package goal completed successfully.

  24. Run the application.

Run the application 

Run the application.

This section has demonstrated importing a pom.xml from a Maven Project. You may also want to review the application code provided within This is but a simple HelloWorld application and this theme will be utilized further in the next section where I'll create a JDeveloper 11g HelloWorld Application Workspace configured to leverage Apache Maven. This section has touched on some of the Apache Maven features available within JDeveloper 11g and more features will be demonstrated in the following sections.

Create JDeveloper 11g Application Configured for Maven

The first thing to do is to create a new application workspace in JDeveloper. Here are the steps:

  1. Create a new application workspace either from the File menu or Application Navigator within JDeveloper. Provide a name or go with the default.
  2. Create Workspace 

    Create a new Application workspace and select the Maven Application Template. 

  3. Name the Application Workspace appropriately and provide an Application Package Prefix.
  4. Workspace Name 

    Name the Application.

  5. Name the project or go with the defaults. Ensure that the Maven Project Technology is included by default.
  6. Name Project 

    Name the project or go with the default.

  7. Configure your Maven settings as required.
  8. Configure Maven settings 

    Configure Maven settings.

  9. An Application Workspace is created configured for a Maven project with a pom.xml.
  10. Review Application Workspace 

    Review the Application Workspace.

  11. Create a new java object by right selecting on your project and selecting New from context.
  12. Create New Java Object 

    Create a New Java Object.

  13. Select "Java Class" followed by OK.
  14. Create New Java Object 

    Create a New Java Object.

  15. Give your java class an appropriate name and select Main Method below if you want a quick method of testing your application.
  16. Name Java Object 

    Name your Java Class.

  17. Open your pom.xml and begin to enter a new tag element such as packaging and you will notice Code Insight is provided on your pom.xml file.
  18. Code Insight 

    Code Insight provided on your pom.xml.

  19. Review the contents of your pom.xml.
                            <?xml version="1.0" encoding="UTF-8" ?>
                            <project xmlns="">
                              <description>Project for mavenProj</description>


  21. Configure your Maven Project Properties as illustrated in the previous section. Here I'm adding some Goals in addition to the default one of package. Save your workspace.
  22. Configure Project Properties 

    Configure Maven Project Properties.

  23. Right select on your pom.xml and select "Run Goal(s)" from context followed by selecting the package goal.
  24. Run Package Goal 

    Run the package goal.

  25. Review the status of running the package goal to ensure that the build was successful.
  26. Review Build Message 

    Review status of running the package goal.

  27. Run the application and see the results.

Run Application 

Run application.

This section has demonstrated creating a Application Workspace in JDeveloper 11g configured for Apache Maven. This is but a simple HelloWorld application as in the first section. This section has touched on some of the Apache Maven features available within JDeveloper 11g as before with some additional features of Code Insight within the pom.xml and more.

Additional Maven Features Provided in JDeveloper 11g

Some new Maven features that have been added to JDeveloper 11g include Project and POM dependency syncing as well as better Repository Managment. First a quick look at Project and POM dependency syncing.

Project and POM dependency syncing

  1. You select project properties and add libraries to your POM file. In this example, I'll add ADF Faces Runtime 11 libraries. Once you select ok on the Project Properties dialog, you'll notice that the selected libraries are added to you Maven repository such that POM can manage the project.
  2. Dependency Syncing 

    Add a ADF Faces Runtime 11 libraries.

  3. Once you select ok on the Project Properties dialog, you'll notice that the selected libraries will be added to your Maven repository such that the POM can manage the project.
  4. Add libraries to Maven repository 

    Add libraries to the Maven repository.

  5. Select the Export checkbox and ok to add the dependency.
  6. Add dependency 

    Add the dependency.

  7. Review the POM file to see that the dependency has been added.


  9. Another scenario could be that a dependency was added directly to the POM file. In that case if you were to look at the Project Properties and Maven Dependencies you would notice the message in red in this image.
  10. Project and POM dependency syncing 

    Notice the alert that the project POM has dependencies that are not listed..

  11. Select Add from POM to add the library.
  12. Add POM dependency to Project 

    Add POM dependency to Project and review the POM file again to see that the dependency has been added.

  13. One last point here before moving on to another feature is that during the creation of a POM for a project, the dependencies from the project jpr will be copied to the POM file as expected..

Repository Management

Oracle JDeveloper now allows for better management of Maven repositories.
  1. Right select on the Application workspace and select Application Properties.
  2. Application Properties 

    Application Properties.

  3. Notice you can add additional remote repositories, change the local repository, as well as use custom settings. You can also add Goals, additional Dependencies as well as work with the Maven settings.
  4. Application Properties 

    Application Properties.

  5. Likewise you can right select on the Project and select Project Properties and have access to additional configuration properties such as the ability to specify the options for the Maven process, including the Java version and environment variables..

Project Properties 

Project Properties.

For further information on Oracle JDeveloper & Apache Maven please visit the following sites.


Maven is a powerful build tool with many unique capabilities. Maven Integration within JDeveloper 11 g includes the following, most of which has been demonstrated in this How-To.

  • Import POM.xml
  • Create POM.xml for project, application
  • Configure, run Maven goals
  • Create, reuse Maven templates (archetypes). For details on Archetypes, refer the Apache Maven Archetypes Page.
  • Configure Maven version, repositories, command line options, environment variables,...
  • Specify dependencies from repository
  • Code inside within POM.xml
For further information on Oracle JDeveloper & Apache Maven please visit the following sites.