Announcement Announcement Module
Collapse
No announcement yet.
mappingJarLocations problem / Maven2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mappingJarLocations problem / Maven2

    hi all,
    i know i should post this to maven list but it is about spring and i am sure someone here is using maven for building its environment

    I have an app composed of 3 project:
    - domain OBjects , contains domain objects used by web and backend project
    - backend project contains hibernate code
    - webapp contains webwork code that uses hibernate to access database

    i have been searching for solutions for not hardcoding hibernate mapping files.. i came across mappingJarLocations where you can specify jars where hbm.xml file are located.
    this is fine, however i am building my project using maven2 and i am setting the dependency scope for domainObjects.jar on my backend project..
    if i use
    Code:
    <scope>test</scope>
    test will fail because spring won't be able to find hbm.xml file (jar is not in classpath)

    if i use
    Code:
    <scope>compile</scope>
    jar won't be in test classpath....
    i was wondering if anyone on this forum came across same situation...

    thanks in advancea nd regards
    marco

  • #2
    hello
    little update to this (i m still lost

    the jar file is in the classpath.... but unfortunately it looks like
    spring won't be able to find it if i declare mappingJarLocations as following
    Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    	    <property name="dataSource">
    			<ref bean="dataSource"/>
    	    </property>
    	    <property name="mappingJarLocations">
    	    	<list>
    				<value>classpath:*domainObjects-1.0-SNAPSHOT.jar</value>
    			</list>
    		</property>  
    		<property name="hibernateProperties">
    		 <ref bean="exampleHibernateProperties" />
    	    </property>
    	</bean>
    If instead i declare property as following (by hardcoding hte path) it works
    Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    	    <property name="dataSource">
    			<ref bean="dataSource"/>
    	    </property>
    	    <property name="mappingJarLocations">
    	    	<list>
    				<value>file:///home/marco/WebWorkMain/domainObjects/target/domainObjects-1.0-SNAPSHOT.jar</value>
    			</list>
    		</property>  
    		<property name="hibernateProperties">
    		 <ref bean="exampleHibernateProperties" />
    	    </property>
    	</bean>
    did anyone ever succeeded to use mappingJarLocations with classpath: ??

    thanks and regards
    marco

    Comment

    Working...
    X