|
|
|
So we should make it optional in the service layer, as well as specify it (and make it optional) the web modules? Then modify the archetypes to have the persistence module as a dependency?
That was the idea. Unfortunately the war plugin explicitly excludes any dependencies marked as optional from WEB-INF/lib and the Canoo web tests then fail- I will need to revise the solution.
The service layer should have an explicit dependency on the data-commons project as this is invarient of the chosen DAO layer. I added an explicity dependency on appfuse-data-common to service/pom.xml and web/common/pom.xml. Unfortunately, the web tests still fail.
Entered as a "wish" in Maven's JIRA: http://jira.codehaus.org/browse/MNG-2757
Fixed DAO framework switching problem by excluding appfuse-hibernate (the default) and then adding the dependency back in with a ${dao.framework} variable taht will be read from the local pom.xml. Here's the code to change existing projects:
<dependency> <groupId>org.appfuse</groupId> <artifactId>appfuse-${web.framework}</artifactId> <version>${appfuse.version}</version> <type>warpath</type> <!-- This exclusion and the dependency following this one allow DAO framework switching. --> <!-- You only need these if you want to use JPA or iBATIS. See <!-- It does no harm to leave it in for Hibernate, but it's not needed. --> <exclusions> <exclusion> <groupId>org.appfuse</groupId> <artifactId>appfuse-hibernate</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.appfuse</groupId> <artifactId>appfuse-${dao.framework}</artifactId> <version>${appfuse.version}</version> </dependency> Of course, if you know of a better solution - please let me know! |
|||||||||||||||||||||||||||||||||||||||||||||||
For AppFuse the simplest solution is going to be to make the DAO framework an optional dependency on the web tier. Child projects can then choose their persistence framework by explicitly setting the dependency themselves.