Thursday, December 11, 2008

JDeveloper and Maven 2.x

Unfortunately the Maven extension for JDeveloper still hasn't seen the light of day; but I was wanting to work with the source for Jersey so I need to get something working otherwise getting all the dependencies by hand would be a nightmare. For Maven 1.x you used to be able to just run "jdev:jdev" to generate projects and workspaces in much the same way "eclipse:eclipse" does the same for erm, well Eclipse.

For 2.x there is no easy to use command in the central repositories, but you can use a plugin from the "myfaces" to generate JDeveloper 10.1.3 project. For of all you need to check out the myfaces build extensions from:

svn checkout http://svn.apache.org/repos/asf/myfaces/trinidad-maven/\
trunk/maven-jdev-plugin maven-jdev-plugin -r 711393

If you don't use the revision modifier then you might get the tip which in my case didn't have all the dependencies published yet. You can try a more recent version if you like, let me know how you got on. Then when you have the source just perform the "mvn install" step to put this plugin in your local repository. (Under ~/.m2/repository on my Linux box)

You can now run the command "mvn -Djdev.release=11.1.1.0.0 org.apache.myfaces.trinidadbuild:maven-jdev-plugin:jdev" in the root of your project and you get a project file for each sub pom and a workspace to contain them all.

I couple of items of note:

  • It generates the project files for JDeveloper 10.1.3.4 so you have to upgrade Apparently if you pass in the java system property "-Djdev.release=11.1.1.0" you get files compatible with the recent
  • It does correctly create public_html
  • It does generate dependencies between projects
  • The project libraries are in terms of your local maven repository, you can't share your project artefacts.
  • It doesn't generate a resource path so you can't see the pom in the project
  • It doesn't create deployment descriptors

Having said that this is a good first step to get working. You can use "Tools->External Tools" so you can run Maven commands from inside of JDeveloper.

3 comments:

Unknown said...

Hello Gerard,

I'm testing Jdev 11g (release 11.1.1.1.0) and I´m trying to configure my project with Maven 2 (release 2.2.1) however I have found that there is no "util" information about that so my only chance was your blog.

I downloaded with SVN the trinidad-jdev last release and realize that the POM.XML is wrong so I downloaded your rBuilt.

It worked fine and also the mvn install.

However I'm not sure how to use the plugin because I wrote:
"mvn -Djdev.release=11.1.1.0.0 org.apache.myfaces.trinidadbuild:maven-jdev-plugin:jdev" but it fails with the next stacktrace:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: resources. It requires a project with an existing po
m.xml, but the build is not using one.
...........


Can you help me??

Gerard Davison said...

I can try, can you tell me a little bit more about your project structure? What do you have on disk before you run this command?

Rodrigo said...

Gts, try this first :
mvn archetype:create -DgroupId=youpackage -DartifactId=NameOfProject -DarchetypeArtifactId=maven-archetype-webapp

And then go inside directory and execute :

mvn -Djdev.release=11.1.1.0.0 org.apache.myfaces.trinidadbuild:maven-jdev-plugin:jdev