views:

21

answers:

2

Hey.

I'm about to start working on a web-application and I'll be using Maven. I want the web-application to be an individual artifact. The web-application will end up depending on a couple of self written libraries (for example text-formatting), and each of these libraries should be an individual artifact.

What's the recommended way of achieving this separation while making it simple to code for both artifacts? I was thinking of creating one project for each artifact and import them one by one in Eclipse. However, if the pom for web-application has a dependency pointing at the self written library, I'll end up having to deploy a snapshot every time I want to see if the change I made stopped the web-application from crashing (in example).

I hope you understand what I am getting at. I'll be working with a couple more developers, and we're using Nexus to maintain our shared artifact repository.

+2  A: 

I was thinking of creating one project for each artifact and import them one by one in Eclipse.

Yes, that's the recommended way.

However, if the pom for web-application has a dependency pointing at the self written library, I'll end up having to deploy a snapshot every time I want to see if the change I made stopped the web-application from crashing

During development, you can use "workspace resolution" i.e. configure Eclipse to resolve dependencies from the workspace. This way changes are immediately visible from the webapp. This is possible whether you are using m2eclipse or the maven eclipse plugin (and is actually the default behavior for both).

Below, an illustration for m2eclipse:

alt text

Pascal Thivent
Thanks a lot! It's not the first time you've given me a detailed and to the point answer. I'd give you an extra "up" if I could.
John
@John You're welcome. And thanks for the extra "up" :)
Pascal Thivent
+1  A: 

A good maven plugin for eclipse is capable of "workspace resolution", i.e. it will recognize if the dependency is also present in the workspace, and refer to the other project directly rather than adding a JAR to the build path.

meriton
Thanks meriton. I've got it up and running! :-)
John