2

I have 3 maven modules. In one module MAIN - I have dependency from 2 another (MODULE1 and MODULE2). All modules based on spring mvc. So, in all modules I use tiles as template constructor. In MAIN module in mvc-dipatcher-servlet.xml i try to configurate it

<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass">
        <value>
        org.springframework.web.servlet.view.tiles2.TilesView
        </value>
    </property>
</bean>

<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/module-one-tiles.xml</value>
            <value>/WEB-INF/module-main-tiles.xml</value>
        </list>
    </property>
</bean>

But it gives me an error, that it cannot find module-one-tiles.xml file. I also tried to use classpath*, the same result. Is it possible to add tiles.xml files from another maven modules?

jmj
  • 237,923
  • 42
  • 401
  • 438
nabiullinas
  • 1,185
  • 4
  • 20
  • 41

1 Answers1

1

if your module jar contains /WEB-INF/module-one-tiles.xml at this location and your module jar is in classpath of your MAIN module then

<value>classpath:/WEB-INF/module-one-tiles.xml</value>

would work

jmj
  • 237,923
  • 42
  • 401
  • 438
  • No, It doesn't work. java.io.FileNotFoundException: class path resource [WEB-INF/ub-blog-tiles.xml] cannot be resolved to URL because it does not exist. And what does it mean "your module jar is in classpath of your MAIN module then"? In my main module.pom I have com.springapp moduleone 1.0-SNAPSHOT and in moduleone pom com.springapp moduleone jar – nabiullinas Jan 06 '14 at 08:34
  • post structure of your module jar which contains this xml file – jmj Jan 06 '14 at 08:36
  • Path to xml is: src -- main -- webapp -- WEB-INF -- module-one-tiles.xml – nabiullinas Jan 06 '14 at 08:39
  • in your jar please, and edit your question to include it – jmj Jan 06 '14 at 08:40
  • Oh, i opened it. It doesn't provide any resourses... Can you help me, what I need to add to moduleone pom.xml to add resourses to jar? – nabiullinas Jan 06 '14 at 08:43
  • please post your jar structure that contains this xml files in your question – jmj Jan 06 '14 at 08:46
  • It only hase one controller.java file. Thats all – nabiullinas Jan 06 '14 at 09:27
  • I think I understand. I changed my pom file(add resourses import) and it start working. Now I need to set normal directory in module jar, I think I will understand it) thank you very much – nabiullinas Jan 06 '14 at 09:44