directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <>
Subject Re: Embedding ApacheDS as a Web Application
Date Fri, 10 Oct 2008 20:21:35 GMT
Stefan Zoerner schrieb:
> Hi Felix,
> thanks for the feedback. Sorry for the late reply, I am currently
> totally overloaded.
> Felix Knecht wrote:
>> I tried to run the example [1] from the page on a linux box. It didn't
>> worked, because there are some hardcoded
>> (Windows) paths in the build.xml:
> My fault. I thought about changing it to use ivy. But I did not had the
> time, to do this, and my maven skills are really lame. And I thought,
> mvn is overkill for simply compiling two classes and create a war file
> with some libs from it ...
>> Following the well done documentation I created an archetype to let
>> maven2 create a sample project similar to the one
>> mentioned in the zip file.
> Great!
>> I'm able to create a new project with the archetype, build it, put the
>> generated war into an apache-tomcat-6.0.18, run
>> it and get the RootDSE page shown. I'm not sure if this is all the
>> magic and if you can get the RootDSE page you're sure
>> that everything else is also working well?
> I have also run some tests with an LDAP client against the running
> webapp, and it worked fine as well. I think it is not necessary to do
> more. It is simply an example about how to embed ApacheDS somewhere, and
> the web app approach looked charmingly easy.
>> To get the archetype-plugin check it out from my sandbox [2] and build
>> it (mvn install). 
> This worked fine.
> Then you should be able to
>> create a new project using
>> mvn archetype:generate \
>>   -DgroupId=org.example \
>>   -DartifactId=myProject \
>>   -Dversion=1.0-SNAPSHOT \
>> \
>>   -DarchetypeArtifactId=embed-apacheds-archetype \
>>   -DarchetypeVersion=1.0-SNAPSHOT
> This worked as well. Although I am a little bit confused about the two
> steps. First I checkout the archetype-plugin and build it. Then I use
> this plugin to create a new mvn project. Afterwards I build this one as
> well. Finally, I have the web app as in the example. And I am able to
> create many other webapps with the same content as a template.

This is easy to explain:
ATM the archetype plugin sin't deployed anywhere, so it's not downloadable. That's why you
need to checkout and build
the archetype plugin first (and then you have it in your local maven repository).
If once a snapshot or release is deployed somewhere you can add this location as well to mvn
archetype.... and that's it.
-> Run one maven command and you have created a new maven project containing a sample how
to use embedded ApacheDS
(corresponds to download and unzip your sample)
-> Change into the project and run mvn install (corresponds to run ant script)
-> in both cases you should get a war file you can deploy where ever you want

At least I think your sample works like this.

> It is impressive, how it works, but I question myself, whether a simple
> maven project is perhaps more appropriate for the task.

As said it generates a maven project. I think the intention of archetypes are exactly this
to generate a maven project
skeleton for a user.

>> If you think it's ok and usefull we can move it from the sandbox to
> the matured projects.
> My goal was to have a simple example for embedding the server in the
> docs for people to get inspired. You build a tool which acts as a blue
> print for comparable web apps, which may act as a starting point.
> Question: Is it a common task to embed ApacheDS in a WebApp at all?

I've absolutely no idea. I just saw your sample and thought that we could migrate this also
into a mvn build as all the
directory projects are now build with maven (finally studio does also, thanks to Pierre-Arnaud).

> The funny thing: The example was quite often cited in the mailing list.
> This is why I tried to update it ...

Me too ;-)

> I would have favored a sub-project for samples, in which the ApacheDS
> embedded in a WebApp is one of them. What do others think?

Do we have other samples yet (sorry for this inocent question)?
I think if the samples are maven projects creating archetypes should be the way to go.

If you just run 'mvn archetype:generate' you see a list of already existing and registered

> Anyway, we need a better way to build the example, in order to make it
> easier for users to let it run. 

In fact, we can add some jetty configuration to the generated project and then a user can
simply create a new project
using the archetype, change into the created project and run something like 'mvn install jetty:run'
and there is a
running embed-apacheds he can connect to :-)

Your mvn approach is obviously better
> than putting a zip-File without dependency resolution in the wiki. Thank
> you therefore for the excellent work you did, Felix!
> Greetings from Hamburg,
>     Stefan

View raw message