You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michael Mühlebach <mm...@gmail.com> on 2007/12/06 09:51:46 UTC

Build an Eclipse (3.3) RCP Application with Maven2

Hello

I am sure this question must have been asked several times but I
really searched for an answer in here as well as with google etc and
found nothing sophisticating.
It might be related with me being quite new in the maven world and
maybe do not really know what I want to know :-)

But now to my question:
In our project we have a classic server client application (nothing
special on server side .. pure old java  with tibco for our
communication).

The client is an Eclipse RCP application built on version 3.3.1 which
has several plugins.
Here are my fist difficulties: Is the client one project in maven or a
multi module project which has for each plugin a project like it is in
eclipse itself? I choose the second choice because the first would end
in a huge project which will make testing a pain in the *** and with
the second one we can add common projects which are shared between
server and client easily as plugin in the client and as jar in the
server.

With the maven-eclipse-plugin it works just fine with the manifest
generation but I have real difficulties with the dependencies to the
RCP Libraries/Plugins ... I tried the way explained on codehaus
(http://docs.codehaus.org/display/MAVENUSER/Eclipse+Plugin) but it did
not work :-(

Is this the correct way to go and I just have to solve my last
dependency problem or am I completely off? I ask this because I have
seen solutions which only use the pde build which is in my opinion the
wrong stage: The pde build is something for installation/deployment
and should be used at the end for integration tests AFTER compilation
and unit tests. Why? Unit tests should be quite fast (just several
seconds) which is not possible if they depend on the pde build.

I hope somebody can point me the right direction or could show me an
other project with a similar build up.

thanks in advance
greets
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Build an Eclipse (3.3) RCP Application with Maven2

Posted by Graham Leggett <mi...@sharp.fm>.
Michael Mühlebach wrote:

> The client is an Eclipse RCP application built on version 3.3.1 which
> has several plugins.
> Here are my fist difficulties: Is the client one project in maven or a
> multi module project which has for each plugin a project like it is in
> eclipse itself?

To help you understand how to solve this, you need to know what the two 
main maven plugins that may help you, do. Once we figured this out, it 
made things significantly easier.

First, the maven-eclipse-plugin. The purpose of this plugin is to 
synchronise information (mainly dependencies) from the maven world, into 
the eclipse world, and that is it.

To do this, the maven-eclipse-plugin either creates or modifies the 
.classpath, .project and MANIFEST.MF files in your Eclipse plugin 
project, with various details that maven knows.

The maven-eclipse-plugin doesn't have any knowledge on how to build 
anything, its job ends at synchronising the configs between the two.

The second, the pde-maven-plugin, allows you to trigger an Eclipse PDE 
build from within maven, and deploy the resulting build into the maven 
repository.

This second part is important to understand: The pde-maven-plugin simply 
wraps the Eclipse PDE build system so that it can be started off by 
maven, and again, doesn't do anything more.

The key secret behind getting this to work, is to create a working 
Eclipse PDE build, and one this works - to wrap this build in 
pde-maven-plugin so maven can kick it off.

Some things you will need to do to get this to work:

- Your directory structure and project layout will be dictated to you by 
Eclipse PDE. Maven will have to conform to whatever directory layout 
Eclipse wants, not the other way around.

What Eclipse typically wants is a directory called "plugins", and each 
plugin underneath this directory. We set up a multi-module maven config, 
with a root pom in the same directory as "plugins", and including 
submodule poms in each plugin directory, like this:

pom.xml
plugins/
plugins/com.example.plugin1/
plugins/com.example.plugin1/pom.xml
plugins/com.example.plugin2/
plugins/com.example.plugin2/pom.xml

- If your plugins depend on plain-old-java-objects or EJBs (as is 
typical in a client server environment), then there is more fun.

If you use EJB3 and simple interfaces, you may be able to create an 
Eclipse plugin containing your EJB interface, that is both an eclipse 
plugin, and an EJB. Because it is a plugin, Eclipse sees it using the 
standard eclipse mechanism, and because it is an EJB deployed in a maven 
repository, your client/server backend can use the same jar file and not 
care that eclipse is involved.

The second way to do this, which if you don't have a clean interface 
between the Eclipse RCP stuff and the server, is to make your eclipse 
plugin depend directly on the jars you need by specifying them in the 
plugin pom, described here:

http://maven.apache.org/plugins/maven-eclipse-plugin/pde.html

Regards,
Graham
--