You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christoph <ch...@fjh.com> on 2009/03/10 11:22:17 UTC

Best practice: web service project structure

Hi,

we're want to setup a couple of web service projects that have to provide
several artifacts:
* ws-client.jar: contains everything required to call the WS
* ws-impl.jar: provides the implementation of a WS
* ws-core.jar: contains base classes used by both of the others

This way a WS client is not forced to have dependencies required for WS
implementation. Quite common, I think.

Now... the question is, how to best set this up with Maven. I didn't find
very much in documentation and mailing lists about how to structure the
projects. IMO there are two options:

1) Have a single Maven project that generates multiple artifacts (JAR
files). They could all have the same base name but a distinct classifier,
for instance. Assembly plugin could be useful, right? Of course, all JARs
must be deployed in the end.

2) Use a multi-module project with dedicated subprojects for the 2
artifacts, so there is one artifact per Maven project. However, this might
be some overhead because some projects will only contain few files.

What do you think, which way is the preferred one? How are YOU doing WS
projects?

Thanks for any opinion,
Christoph
-- 
View this message in context: http://www.nabble.com/Best-practice%3A-web-service-project-structure-tp22431433p22431433.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Best practice: web service project structure

Posted by Thor <me...@gmail.com>.
Rusty's right...
IMHO the best approach is to use multimodule projects, with an api, an
implementation (pojos, ejbs, etc.), a ws (web services :-p), a client, and
optionally a util module.
That way you can use the interfaces of your api in each module needed and
your utilities also...

Regards...


On Tue, Mar 10, 2009 at 7:09 PM, Rusty Wright <ru...@gmail.com>wrote:

> Sorry, I should have used the url for Better Builds with Maven;
>
> http://www.exist.com/better-build-maven
>
> I'm not saying that it has the answer, just tossing it out since it has a
> section on doing a web services client, in case you haven't looked at it (I
> can't tell if they're doing the server side).
>
> I've wondered about a similar thing, which is to put all of the public
> interfaces in a separate jar, and call it something like myapp-api.jar.
>
>
>
> Christoph wrote:
>
>> Thanks Rusty, but this is actually not answering my question...
>>
>> I know how to do multi-module projects in principle, I'm just wondering if
>> that is the right approach to structure a single web service to get
>> separate
>> JARs for the different "views" on it (client view, impl view).
>> A WS should be considered one logical "project" but still I think it is
>> useful to get one JAR used by WS callers, another JAR used by WS
>> implementation and maybe a third JAR containing common classes used by
>> both.
>> Does this make sense? If so, how to best achieve that?
>>
>> Christoph.
>>
>>
>>
>> Rusty Wright-2 wrote:
>>
>>> http://www.sonatype.com/books/maven-book/reference/
>>>
>>> Have a look at the multi-module projects.
>>>
>>>
>>> Christoph wrote:
>>>
>>>> Hi,
>>>>
>>>> we're want to setup a couple of web service projects that have to
>>>> provide
>>>> several artifacts:
>>>> * ws-client.jar: contains everything required to call the WS
>>>> * ws-impl.jar: provides the implementation of a WS
>>>> * ws-core.jar: contains base classes used by both of the others
>>>>
>>>> This way a WS client is not forced to have dependencies required for WS
>>>> implementation. Quite common, I think.
>>>>
>>>> Now... the question is, how to best set this up with Maven. I didn't
>>>> find
>>>> very much in documentation and mailing lists about how to structure the
>>>> projects. IMO there are two options:
>>>>
>>>> 1) Have a single Maven project that generates multiple artifacts (JAR
>>>> files). They could all have the same base name but a distinct
>>>> classifier,
>>>> for instance. Assembly plugin could be useful, right? Of course, all
>>>> JARs
>>>> must be deployed in the end.
>>>>
>>>> 2) Use a multi-module project with dedicated subprojects for the 2
>>>> artifacts, so there is one artifact per Maven project. However, this
>>>> might
>>>> be some overhead because some projects will only contain few files.
>>>>
>>>> What do you think, which way is the preferred one? How are YOU doing WS
>>>> projects?
>>>>
>>>> Thanks for any opinion,
>>>> Christoph
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Open Jfree Software in an Open World...

Re: Best practice: web service project structure

Posted by Rusty Wright <ru...@gmail.com>.
Sorry, I should have used the url for Better Builds with Maven;

http://www.exist.com/better-build-maven

I'm not saying that it has the answer, just tossing it out since it has a section on doing a web services client, in case you haven't looked at it (I can't tell if they're doing the server side).

I've wondered about a similar thing, which is to put all of the public interfaces in a separate jar, and call it something like myapp-api.jar.


Christoph wrote:
> Thanks Rusty, but this is actually not answering my question...
> 
> I know how to do multi-module projects in principle, I'm just wondering if
> that is the right approach to structure a single web service to get separate
> JARs for the different "views" on it (client view, impl view). 
> 
> A WS should be considered one logical "project" but still I think it is
> useful to get one JAR used by WS callers, another JAR used by WS
> implementation and maybe a third JAR containing common classes used by both.
> Does this make sense? If so, how to best achieve that?
> 
> Christoph.
> 
> 
> 
> Rusty Wright-2 wrote:
>> http://www.sonatype.com/books/maven-book/reference/
>>
>> Have a look at the multi-module projects.
>>
>>
>> Christoph wrote:
>>> Hi,
>>>
>>> we're want to setup a couple of web service projects that have to provide
>>> several artifacts:
>>> * ws-client.jar: contains everything required to call the WS
>>> * ws-impl.jar: provides the implementation of a WS
>>> * ws-core.jar: contains base classes used by both of the others
>>>
>>> This way a WS client is not forced to have dependencies required for WS
>>> implementation. Quite common, I think.
>>>
>>> Now... the question is, how to best set this up with Maven. I didn't find
>>> very much in documentation and mailing lists about how to structure the
>>> projects. IMO there are two options:
>>>
>>> 1) Have a single Maven project that generates multiple artifacts (JAR
>>> files). They could all have the same base name but a distinct classifier,
>>> for instance. Assembly plugin could be useful, right? Of course, all JARs
>>> must be deployed in the end.
>>>
>>> 2) Use a multi-module project with dedicated subprojects for the 2
>>> artifacts, so there is one artifact per Maven project. However, this
>>> might
>>> be some overhead because some projects will only contain few files.
>>>
>>> What do you think, which way is the preferred one? How are YOU doing WS
>>> projects?
>>>
>>> Thanks for any opinion,
>>> Christoph
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
> 

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


Re: Best practice: web service project structure

Posted by Christoph <ch...@fjh.com>.
Thanks Rusty, but this is actually not answering my question...

I know how to do multi-module projects in principle, I'm just wondering if
that is the right approach to structure a single web service to get separate
JARs for the different "views" on it (client view, impl view). 

A WS should be considered one logical "project" but still I think it is
useful to get one JAR used by WS callers, another JAR used by WS
implementation and maybe a third JAR containing common classes used by both.
Does this make sense? If so, how to best achieve that?

Christoph.



Rusty Wright-2 wrote:
> 
> http://www.sonatype.com/books/maven-book/reference/
> 
> Have a look at the multi-module projects.
> 
> 
> Christoph wrote:
>> Hi,
>> 
>> we're want to setup a couple of web service projects that have to provide
>> several artifacts:
>> * ws-client.jar: contains everything required to call the WS
>> * ws-impl.jar: provides the implementation of a WS
>> * ws-core.jar: contains base classes used by both of the others
>> 
>> This way a WS client is not forced to have dependencies required for WS
>> implementation. Quite common, I think.
>> 
>> Now... the question is, how to best set this up with Maven. I didn't find
>> very much in documentation and mailing lists about how to structure the
>> projects. IMO there are two options:
>> 
>> 1) Have a single Maven project that generates multiple artifacts (JAR
>> files). They could all have the same base name but a distinct classifier,
>> for instance. Assembly plugin could be useful, right? Of course, all JARs
>> must be deployed in the end.
>> 
>> 2) Use a multi-module project with dedicated subprojects for the 2
>> artifacts, so there is one artifact per Maven project. However, this
>> might
>> be some overhead because some projects will only contain few files.
>> 
>> What do you think, which way is the preferred one? How are YOU doing WS
>> projects?
>> 
>> Thanks for any opinion,
>> Christoph
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Best-practice%3A-web-service-project-structure-tp22431433p22446776.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Best practice: web service project structure

Posted by Rusty Wright <ru...@gmail.com>.
http://www.sonatype.com/books/maven-book/reference/

Have a look at the multi-module projects.


Christoph wrote:
> Hi,
> 
> we're want to setup a couple of web service projects that have to provide
> several artifacts:
> * ws-client.jar: contains everything required to call the WS
> * ws-impl.jar: provides the implementation of a WS
> * ws-core.jar: contains base classes used by both of the others
> 
> This way a WS client is not forced to have dependencies required for WS
> implementation. Quite common, I think.
> 
> Now... the question is, how to best set this up with Maven. I didn't find
> very much in documentation and mailing lists about how to structure the
> projects. IMO there are two options:
> 
> 1) Have a single Maven project that generates multiple artifacts (JAR
> files). They could all have the same base name but a distinct classifier,
> for instance. Assembly plugin could be useful, right? Of course, all JARs
> must be deployed in the end.
> 
> 2) Use a multi-module project with dedicated subprojects for the 2
> artifacts, so there is one artifact per Maven project. However, this might
> be some overhead because some projects will only contain few files.
> 
> What do you think, which way is the preferred one? How are YOU doing WS
> projects?
> 
> Thanks for any opinion,
> Christoph

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