Ok so now I'm completely lost. The problem I thought I had with source path is not a problem in fact because both source path are used. But after having integrated so many things from so many different sources, my maven configuration files have become such a mess that there are plenty of things I just don't understand. To give you an idea of what I'm trying to achieve, I want to use Hibernate for data persistence with a HSQLDB database. On top of that there should be a Spring container for business and for presentation, I use Cocoon instead of Struts (Cocoon is some kind of XML replacement for Struts). My project structure looks like this :
schaman/ (my project root directory)
src/
java/ (some java sources that are not generated by AndroMDA)
webapp/ (some web stuff like XML source files or XSLT stylesheets)
WEB-INF/ (some configuration files for Cocoon)
mda/
schaman.xml.zip (my UML model designed with MagicDraw 9.5 CE)
target/
java/ (sources files and XML configuration files generated by
"maven mda"
webapp/ (expanded web application to be deployed, with
everything compiled)
And I joined my four Maven configuration files.
With all of that, I run "maven mda", then "maven war:webapp" and I can
see several problems :
1 - in target/java I have no configuration.hbm.xml file generated
2 - XML configuration files for Spring and mapping files for Hibernate
are generated in target/java but they are not copied into
target/webapp/WEB-INF/classes as they should
3 - Where do all those classes come from. I just have one simple User
class and I end up with some strange classes like :
- CriteriaSearch
- CriteriaSearchConfiguration
- CriteriaSearchParameter
- PrincipalStore
- UserDao
- UserDaoBase
- UserImpl
4 - And what about those XML files ?
- applicationContext.xml
- applicationContext-dataSource.xml
- beanRefFactory.xml
I'm a beginner with Hibernate and I don't have much knowledge about
Spring so maybe the tutorials I'm reading will help me answer a few of
these questions. And I'm certainly integrating dependencies I
shouldn't integrate but I'm afraid that if I remove them, some
dependency transitivity error will occur.
Could anyone have a look at my configuration files and help me
disentangle that mess and come up with a working configuration. As
soon as I will have this working configuration it should be just fine.
My real model is already made. So please... help !
Tim's success story made me dream, but obviously I need more knowledge
about Spring and Hibernate to understand what's going on.
Thank you very much in advance.
--
Sebastien ARBOGAST
build.properties
Description: Binary data
<?xml version="1.0" encoding="ISO-8859-1"?>
<project default="install" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven"
xmlns:j="jelly:core" xmlns:util="jelly:util">
<ant:property environment="env"/>
<preGoal name="clean">
<ant:delete>
<ant:fileset dir="${basedir}">
<ant:include name="**/*.log*"/>
<ant:include name="**/*.exc*"/>
</ant:fileset>
</ant:delete>
</preGoal>
<!-- mda -->
<goal name="mda">
<attainGoal name="andromda:run"/>
</goal>
<!-- java -->
<preGoal name="java:compile">
<ant:path id="mda.java.src" location="${maven.build.dir}/java"/>
<maven:addPath id="maven.compile.src.set" refid="mda.java.src"/>
</preGoal>
<goal name="install" prereqs="mda, jar:install, war:install, ddl" />
<goal name="deploy" prereqs="undeploy,war">
<attainGoal name="jboss:deploy-warfile" />
</goal>
<goal name="undeploy">
<attainGoal name="jboss:undeploy-warfile" />
</goal>
<!-- db -->
<goal name="ddl">
<ant:path id="schema.classpath">
<ant:path refid="maven.dependency.classpath"/>
<ant:path location="${maven.build.dir}/classes"/>
</ant:path>
<ant:mkdir dir="${maven.build.dir}/sql"/>
<ant:fileset id="hibernate.mapping.files" dir="${maven.build.dir}/java">
<ant:include name="**/*.hbm.xml"/>
</ant:fileset>
<ant:pathconvert refid="hibernate.mapping.files"
property="hibernate.mappings" pathsep=" "/>
<ant:java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport"
fork="true">
<ant:arg value="--output=${maven.build.dir}/sql/create.sql"/>
<ant:arg value="--text"/>
<ant:arg value="--quiet"/>
<ant:arg value="--delimiter=;"/>
<ant:arg value="--format"/>
<ant:arg line="${hibernate.mappings}"/>
<ant:jvmarg
value="-Dhibernate.dialect=net.sf.hibernate.dialect.HSQLDialect"/>
<ant:classpath refid="schema.classpath" />
</ant:java>
<ant:copy file="${maven.build.dir}/sql/create.sql"
tofile="${maven.build.dir}/sql/recreate.sql"/>
<ant:replaceregexp file="${maven.build.dir}/sql/create.sql"
match="^(alter table .* drop constraint|drop table|drop sequence)"
replace="-- SKIP \1" flags="i" byline="true"/>
<ant:java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport"
fork="true">
<ant:arg value="--output=${maven.build.dir}/sql/drop.sql"/>
<ant:arg value="--text"/>
<ant:arg value="--quiet"/>
<ant:arg value="--drop"/>
<ant:arg value="--delimiter=;"/>
<ant:arg value="--format"/>
<ant:arg line="${hibernate.mappings}"/>
<ant:jvmarg
value="-Dhibernate.dialect=net.sf.hibernate.dialect.HSQLDialect"/>
<ant:classpath refid="schema.classpath" />
</ant:java>
</goal>
<goal name="create">
<j:set var="script" value="${maven.build.dir}/sql/create.sql"/>
<attainGoal name="exec"/>
</goal>
<goal name="data">
<j:set var="script" value="${maven.src.dir}/sql/data.sql"/>
<attainGoal name="exec"/>
</goal>
<goal name="recreate">
<j:set var="script" value="${maven.build.dir}/sql/recreate.sql"/>
<attainGoal name="exec"/>
</goal>
<goal name="drop">
<j:set var="script" value="${maven.build.dir}/sql/drop.sql"/>
<attainGoal name="exec"/>
</goal>
<goal name="exec">
<j:if test="${script != null}">
<util:file var="scriptFile" name="${script}"/>
<j:if test="${scriptFile.exists()}">
<ant:sql driver="org.hsqldb.jdbcDriver" src="${scriptFile}"
url="jdbc:hsqldb:hsql://localhost:9003" userid="sa"
password="" >
<ant:classpath>
<ant:pathelement
location="${maven.repo}/server/default/lib/hsqldb.jar"/>
</ant:classpath>
</ant:sql>
</j:if>
</j:if>
</goal>
<!-- Cocoon preGoal -->
<preGoal name="war:webapp">
<j:forEach var="dependency" items="${pom.dependencies}">
<j:if test="${dependency.getArtifactId().equals('cocoon')}">
<j:if test="${dependency.getType().equals('war')}">
<j:set var="cocoonWar" value="cocoon-${dependency.getVersion()}.war"/>
<unwar src="${maven.repo.local}/cocoon/wars/${cocoonWar}" dest="${maven.war.webapp.dir}">
<echo>Extracting ${cocoonWar}</echo>
</unwar>
</j:if>
</j:if>
</j:forEach>
</preGoal>
<!-- Utility goal to update non-compiled files only (especially XML) -->
<goal name="update">
<ant:copy todir="${maven.build.dir}/${pom.artifactId}">
<ant:fileset dir="${basedir}/src/webapp"/>
</ant:copy>
</goal>
</project>
project.properties
Description: Binary data
<?xml version="1.0" encoding="UTF-8"?>
<!--
Document : project.xml
Created on : April 1, 2005, 9:36 AM
Author : Sebastien Arbogast
Description:
Maven Project Descriptor SCHAMAN.
-->
<project>
<pomVersion>3</pomVersion>
<id>schaman:schaman</id>
<name>The SCHAMAN Project</name>
<groupId>schaman</groupId>
<artifactId>schaman</artifactId>
<currentVersion>0.1-DEV</currentVersion>
<organization>
<name>Laboratoire de recherche en Réseautique et en Informatique Mobile</name>
<url>http://www.larim.polymtl.ca</url>
<logo>src/webapp/resources/logos/fr_logo_larim.jpg</logo>
</organization>
<inceptionYear>2005</inceptionYear>
<package>ca.polymtl.larim.${pom.artifactId}</package>
<description>SCHAMAN is a content management system to build information services for different media, especially mobile ones, using Web Services and XML technologies.</description>
<shortDescription>Service Creation, Handling and Adaptation for Mobile Application Needs</shortDescription>
<siteDirectory>C:\dev\pfe\schaman\src\site</siteDirectory>
<repository />
<versions>
<version>
<id>2.1.6</id>
</version>
</versions>
<dependencies>
<dependency>
<groupId>cocoon</groupId>
<artifactId>cocoon</artifactId>
<version>2.1.7-minimal</version>
<type>war</type>
</dependency>
<dependency>
<groupId>jta</groupId>
<artifactId>jta</artifactId>
<version>1.0</version>
<type>jar</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework</artifactId>
<version>4.1.5</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>excalibur-datasource</groupId>
<artifactId>excalibur-datasource</artifactId>
<version>1.1.1</version>
<type>jar</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>servletapi</groupId>
<artifactId>servletapi</artifactId>
<version>2.3</version>
<type>jar</type>
</dependency>
<dependency>
<id>commons-logging</id>
<version>1.0.4</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>ant</id>
<version>1.6.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-dbcp</id>
<version>1.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-pool</id>
<version>1.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-dbutils</id>
<version>1.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-collections</id>
<version>3.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-configuration</id>
<version>1.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-io</id>
<version>1.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-jxpath</id>
<version>1.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>commons-lang</id>
<version>2.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.1.8</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.0.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>1.4.3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.4</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>odmg</groupId>
<artifactId>odmg</artifactId>
<version>3.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>0.9</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>springframework</groupId>
<artifactId>spring</artifactId>
<version>1.1.5</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<id>servletapi</id>
<version>2.3</version>
</dependency>
<dependency>
<id>junit</id>
<version>3.8.1</version>
</dependency>
<!-- mda -->
<dependency>
<groupId>andromda</groupId>
<artifactId>andromda-profile</artifactId>
<version>${andromda}</version>
<type>xml.zip</type>
</dependency>
<dependency>
<groupId>andromda</groupId>
<artifactId>andromda-java-cartridge</artifactId>
<version>${andromda}</version>
<properties>
<enumerations>${maven.build.dir}/java</enumerations>
<exceptions>${maven.build.dir}/java</exceptions>
<value-objects>${maven.build.dir}/java</value-objects>
</properties>
</dependency>
<dependency>
<groupId>andromda</groupId>
<artifactId>maven-andromda-plugin</artifactId>
<version>${andromda}</version>
<type>plugin</type>
<properties>
<languageMappingsUri>Java</languageMappingsUri>
<wrapperMappingsUri>JavaWrapper</wrapperMappingsUri>
<sqlMappingsUri>PostgreSQL</sqlMappingsUri>
<jdbcMappingsUri>JDBC</jdbcMappingsUri>
<maxSqlNameLength>30</maxSqlNameLength>
<foreignKeySuffix>_FK</foreignKeySuffix>
<ejbJndiNamePrefix>${pom.id}</ejbJndiNamePrefix>
<classifierNameMask>none</classifierNameMask>
<classifierPropertyNameMask>none</classifierPropertyNameMask>
<operationNameMask>none</operationNameMask>
<roleNameMask>none</roleNameMask>
<enumerationNameMask>none</enumerationNameMask>
<enumerationLiteralNameMask>none</enumerationLiteralNameMask>
<entityNameMask>none</entityNameMask>
<entityPropertyNameMask>none</entityPropertyNameMask>
<parameterNameMask>none</parameterNameMask>
</properties>
</dependency>
<dependency>
<groupId>andromda</groupId>
<artifactId>andromda-spring-cartridge</artifactId>
<version>${andromda}</version>
<type>jar</type>
<properties>
<dataSource>java:/DbUtilDS</dataSource>
<hibernateDialect>
net.sf.hibernate.dialect.PostgreSQLDialect</hibernateDialect>
<hibernateShowSql>false</hibernateShowSql>
<hibernateUseQueryCache>false</hibernateUseQueryCache>
<hibernateQueryUseNamedParameters>
true</hibernateQueryUseNamedParameters>
<hibernateCacheProvider>
net.sf.hibernate.cache.EhCacheProvider</hibernateCacheProvider>
<hibernateInheritanceStrategy>
subclass</hibernateInheritanceStrategy>
<hibernateQueryCacheFactory>
net.sf.hibernate.cache.StandardQueryCacheFactory</hibernateQueryCacheFactory>
<springTypesPackage>${pom.package}</springTypesPackage>
<daos>${maven.build.dir}/java</daos>
<dao-impls>${maven.src.dir}/java</dao-impls>
<spring-configuration>
${maven.build.dir}/java</spring-configuration>
<services>${maven.build.dir}/java</services>
<service-impls>${maven.src.dir}/java</service-impls>
</properties>
</dependency>
<dependency>
<groupId>andromda</groupId>
<artifactId>andromda-hibernate-cartridge</artifactId>
<version>${andromda}</version>
<type>jar</type>
<properties>
<hibernateTypeMappingsUri>Hibernate</hibernateTypeMappingsUri>
<hibernateInheritanceStrategy>
subclass</hibernateInheritanceStrategy>
<defaultHibernateGeneratorClass>
native</defaultHibernateGeneratorClass>
<hibernateDefaultCascade>none</hibernateDefaultCascade>
<entities>${maven.build.dir}/java</entities>
<entity-impls>${maven.src.dir}/java</entity-impls>
<customTypesPackage>${pom.package}</customTypesPackage>
<compositionDefinesEagerLoading>
true</compositionDefinesEagerLoading>
</properties>
</dependency>
<!--
<dependency>
<groupId>andromda</groupId>
<artifactId>andromda-bpm4struts-cartridge</artifactId>
<version>${andromda}</version>
<properties>
<actions>${maven.build.dir}/java</actions>
<forms>${maven.build.dir}/java</forms>
<controllers>${maven.build.dir}/java</controllers>
<controller-impls>${maven.src.dir}/java</controller-impls>
<pages>${maven.build.dir}/webapp</pages>
<decorators>${maven.build.dir}/webapp</decorators>
<messages>${maven.build.dir}/webapp/WEB-INF/classes</messages>
<configuration>${maven.build.dir}/webapp/WEB-INF</configuration>
<security>false</security>
<securityRealm>other</securityRealm>
<serviceAccessorPattern>
${pom.package}.ServiceLocator.instance().get{1}()</serviceAccessorPattern>
<mergeLocation>${maven.src.dir}/mda</mergeLocation>
<mergeMappingsUri>
file:${maven.src.dir}/mda/mappings/bpm4struts.xml</mergeMappingsUri>
<defaultDateFormat>MM/dd/yyyy</defaultDateFormat>
<xhtml>true</xhtml>
</properties>
</dependency>
-->
<dependency>
<groupId>andromda</groupId>
<artifactId>andromda-ocl-validation-library</artifactId>
<version>${andromda}</version>
</dependency>
<dependency>
<groupId>andromda</groupId>
<artifactId>andromda-ocl-query-library</artifactId>
<version>${andromda}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${basedir}/src/java</sourceDirectory>
<unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
</unitTest>
<resources>
<resource>
<directory>${basedir}/src/conf</directory>
<includes>
<include>*.properties</include>
<include>*.xml</include>
<include>*.dtd</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>
