This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Maven build: further separation of modules?

Jun 23rd, 2006, 07:11 PM

One of the issues I want to solve for the upcoming 1.0-M2 build is SWS-28: Maven2 build. People have been asking the Spring framework for proper Maven poms for quite some time now, and while we don't want to switch the core Spring framework to Maven2 yet, we decided to try it with Spring-WS.

Through its transitive dependency functionality, Maven2 can impose certain changes with respect to the modularization of the modules. For instance, the spring-oxm module currently has support for six different XML marshalling frameworks. However, most people only use one at the time, and manually have to add the specific dependency for the XML marshalling API they use (e.g. they have to add to add the jaxb-impl.jar).

When using Maven, we could make this easier by separating spring-oxm into different modules: one core spring-oxm module, and six different spring-oxm module, each with the exact dependencies necessary to work for a particular marshalling API (so spring-oxm-jaxb2 has a dependency to JAXB2, etc.) This means that if you use Maven2 yourself, you don't have to find the dependencies anymore.

The question is: which do you prefer? One hand, it's easy to have one spring-oxm jar which contains everything. On the other hand, it might be useful to further separate things.

1) With maven2 you can easily exclude dependecies. For example, if spring-oxm has 6 compile dependencies to XML marshalling frameworks, it is very easy to add a in my project a dependency to spring-oxm and at the same time exclude 5 dependencies to XML frameworks.

2) It is more clear to have a single pom for a one project than 6 poms for one project.

Comment

Another reason why I prefer further separation is the fact that I cannot run the Jaxb2Marshaller unit tests in the current setup: they use Java 5, and spring-oxm compiles at 1.3.

With regard to poms: I don't think you will end up with 6 spring-ws poms in your project. Through the transitive dependency mechanism, you will only need one (spring-jaxb2 for instance, which depends on spring-oxm, etc.).