Your search did not match any results.
We suggest you try the following to help find what you’re looking for:
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 maven.apache.org 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:
Maven is essentially a project management and comprehension tool and as such provides a way to help with managing:
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:
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/filters||Resource filter files|
|src/main/webapp||Web application sources|
|src/test/filters||Test resource filter files|
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.
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.
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:
Validate Maven Installation: Run mvn --version.
Note: For optional installation settings/configuration please visit the Apache Maven installation page.
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 -DgroupId=com.mycompany.app -DartifactId=my-app
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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>my-app</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>my-app</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
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.
Create Application Workspace.
Provide an Application Name and select Finish. Note a default project will be created for you.
Select "Maven Project".
Select Maven Project(s) to import.
Review imported Maven project..
Maven Project Properties.
Run the Goal of your choice.
Run the package goal.
Review the package goal completed successfully.
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 App.java. 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.
The first thing to do is to create a new application workspace in JDeveloper. Here are the steps:
Create a new Application workspace and select the Maven Application Template.
Name the Application.
Name the project or go with the default.
Configure Maven settings.
Review the Application Workspace.
Create a New Java Object.
Create a New Java Object.
Name your Java Class.
Code Insight provided on your pom.xml.
<?xml version="1.0" encoding="UTF-8" ?> <project xmlns="http://maven.apache.org/POM/4.0.0"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>mavenProj</artifactId> <p <version>1.0-SNAPSHOT</version> <description>Project for mavenProj</description> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source> 1.6 </source> <target> 1.6 </target> </configuration> </plugin> </plugins> </build> <parent> <groupId>com.mycompany.app</groupId> <artifactId>MavenApp</artifactId> <version>1.0-SNAPSHOT</version> </parent> </project>
Configure Maven Project Properties.
Run the package goal.
Review status of running the package goal.
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.
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
Add a ADF Faces Runtime 11 libraries.
Add libraries to the Maven repository.
Add the dependency.
<dependencies> <dependency> <groupId>oracle.jdeveloper.library</groupId> <artifactId>ADF-Faces-Runtime-11</artifactId> <version>220.127.116.11.0</version> <type>pom</type> <scope>compile</scope> </dependency> <dependency> <groupId>oracle.jdeveloper.library</groupId> <artifactId>JSF</artifactId> <version>2.0</version> <type>pom</type> <scope>compile</scope> </dependency> <dependency> <groupId>oracle.jdeveloper.library</groupId> <artifactId>JSTL</artifactId> <version>1.2</version> <type>pom</type> <scope>compile</scope> </dependency> <dependency> <groupId>oracle.jdeveloper.library</groupId> <artifactId>JSP-Runtime</artifactId> <version>18.104.22.168.0</version> <type>pom</type> <scope>compile</scope> </dependency> </dependencies>
Notice the alert that the project POM has dependencies that are not listed..
Add POM dependency to Project and review the POM file again to see that the dependency has been added.
Repository ManagementOracle JDeveloper now allows for better management of Maven repositories.
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.