In the first article on this blog, I tested the Maven capabilities of the JDeveloper 11.1.2 release. And for those dependencies defined within JDeveloper itself as libraries, it creates nicely the required files in the local maven repository and updates the POM.
So the next idea that I had, was to see if I could add dependencies which are only defined in maven, and which are not defined as library in JDeveloper.
External maven dependencies
Since CDI, context and dependency injection, is a natural companion of JSF 2.0 in EE6, I wanted to try that out. The current version of WLS is not an EE6 container but most CDI implementation like OpenWebBeans can be also used in non EE6 container like WLS.
So I started by creating a Maven application and project and the application navigator shows me a project where I can see the pom.xml file.
I opened the file and added one of the maven dependencies of OpenWebBeans. At this point nothing happens; there is no polling or any other mechanism that adds the newly added dependency in the pom.xml file to the project dependencies of the JDeveloper project.
If I open the Maven project properties (right click on the pom.xml file and select the corresponding menu), I can see the information message on the dependencies tab that there are things changed in the pom file that aren't propagated. After clicking on the "add from POM' button, I can see the dependency but to my surprise, the classes aren't available in the code editor.
After checking the Libraries and classpath project properties, I see the reason. The dependency that I added has a dot (.) in the artifactId value. And JDeveloper treats this as a directory separator as in the groupId value.
So I tried another one. This time without a dot in the artifactId value and it works as expected. However, if you tick the ‘show libraries’, you get the list of dependencies added to your project and sees the content of the jar files. This is not the case. But a far larger problem is the fact that JDeveloper don't add the transitive dependencies of the added maven dependencies. If you add a dependency, it should not only add the jar (artifact file in general) but should also look in the pom file of the dependency and add the artifacts that are defined there (if in the correct scope of course).
Without this functionality, it makes the use of JDeveloper as tool in open source coding, a lot less interesting.
Maybe when you import an existing Maven project, the support is better? Well, I bumped into the same problem, the transitive dependencies aren't included. And I saw another thing. The pom file had some properties defined where I specified the version number of the artifacts I would like to use. After importing it in JDeveloper, it has replaced all occurrences of those properties with the defined value. This behavior could also be improved in a future version of JDeveloper.
The Maven support is a first good step. You can now use a Maven build file for ADF based application. This frees you from JDeveloper itself if you want to use a continious integration server like Hudson. But for opensource projects, a few bugs must be tackled and some improvements are required. Maybe the next version?