JDeveloper 12.1.3 is good news for Maven fans

JDeveloper 12c 12.1.3 is finally available. The list of new features and enhancements is quite impressive. Have a look! You will not be disappointed. Personally, I was very happy to discover than Apache Maven support has been enhanced in two small but critical areas: paths and archetypes. Don't get me wrong: Maven support in 12.1.2 is leaps and bounds ahead what 11g offers. But the tweaks brought in 12.1.3 make a significant difference. 

The main issue with the Maven support in 12.1.2 is that the POM files generated by JDeveloper contain absolute paths. This is problematic, since applications will not compile correctly unless the code resides in the same location on all developer workstations and build servers. This is not always possible or even desirable. Thus, I described how to replace those absolute paths with relative ones in a previous blog post. Fortunately, JDeveloper 12.1.3 does things differently and writes its POMs with relative paths instead. 

Maven archetypes help developers create new applications from scratch  from the command line. It is now possible to build a new ADF application that way using the oracle-adffaces-ejb archetype introduced by Oracle in JDeveloper 12.1.3. The resulting application will use EJB for its model layer. To use the archetype, simply issue a command like the one below:

mvn archetype:generate
 -DarchetypeGroupId=com.oracle.adf.archetype
 -DarchetypeArtifactId=oracle-adffaces-ejb
 -DarchetypeVersion=12.1.3-0-0
 -DgroupId=oracle.test
 -DartifactId=my-maven-test
 -Dversion=1.0-SNAPSHOT

 Obviously, this command will be successful only if the Maven binaries directory has been added to the path. Remember that Maven is provided by JDeveloper and can be found in the ORACLE_HOME/oracle_common/modules directory - although you can use your own install instead.

 If you prefer to use a GUI, you can create an application from inside JDeveloper by using a little known option introduced in 12.1.2. First, open the New... gallery and select the Maven subcategory (under the General category). Then, select the Generate from Archetype item.

This will bring up the dialog shown below.

Fill the various values per Maven conventions. The application top level directory will be created under the directory you specify. To select the archetype to use, click on the looking glass besides the Maven archetype field. JDeveloper will then display the Search for Archetypes dialog. To use it, simply type a search string and press Enter. JDeveloper will list all the matching archetypes available for the repositories selected.

Simply select the appropriate archetype and click on OK to create the new application. 

Depending how your environment has been setup, it is possible that your local Maven repository doesn't contain an archetype catalog. If that's the case, the Local Repository option will be grayed out in the Search for Archetypes dialog. To fix this, execute the command below. 

mvn archetype:crawl -Dcatalog=<maven directory folder>/archetype-catalog.xml 

 On Linux and OS X, the local repository is usually found at $HOME/.m2.  On Windows, the default location is %HOMEDRIVE%%HOMEPATH%/.m2. 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Frédéric Desbiens

The musings of a member of the Mobility and Development Tools Product Management team.

I focus here on my favorite development frameworks, namely Oracle ADF and the Oracle Mobile Application Framework (MAF), but also have a strong interest in SOA and web services.

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« March 2015
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today