Assume we have a few projects, each containing some web resources (e.g., html pages).
parent.pom
+- web (war)
+- web-plugin-1 (jar)
+- web-plugin-2 (jar)
...
Let's say web
is the deployable war
project which depends on the known, but selectable, set of plugins.
What is a good way to setup this using Spring
and maven
?
- Let the plugins be
war
projects and use mavens poor support for importing otherwar
projects - Put all web-resource for all plugins in the
web
project - Add all web-resources to the classpath of all
jar
web-plugin-*
dependencie and let spring read files from respective classpath? - Other?
I've previously come from using #1
, but the copy-paste
semantics of war
dependencies in maven is horrible.
1 Answer 1
well, i use to work with point 3, definining all dependencies at parent's pom, including dependencies form modules, like that:
<parent>
<groupId>cat.base.baseframe</groupId>
<artifactId>projecte-pare-baseframe</artifactId>
<version>0.0.11.a</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>ogc.domini</module>
<module>ogc.logica</module>
<module>ogc.ejb</module>
<module>ogc.ear</module>
<module>ogc.ui</module>
<module>ogc.assistent</module>
</modules>
<dependencies>
<dependency>
<groupId>cat.base.cuesfeina</groupId>
<artifactId>cuesfeina.domini</artifactId>
<version>0.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cat.base.gea</groupId>
<artifactId>gea.domini</artifactId>
<version>0.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>baseOnline.ajudes</groupId>
<artifactId>ajudes.domini</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cat.base.tramitador</groupId>
<artifactId>tramitador.domini</artifactId>
<version>0.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cat.base</groupId>
<artifactId>mme.domini</artifactId>
<version>1.3.3</version>
<scope>provided</scope>
</dependency>
-->
everything at pom's parent's it's easy to find what you need. if you need to call some service i i use to create a public jar with functions to call the service like ejb...
-
Dear @ZaoTaoBao please have a sight at my question about creating java multi layer app stackoverflow.com/questions/49562268/…Hosein Aqajani– Hosein Aqajani2018年03月30日 11:53:33 +00:00Commented Mar 30, 2018 at 11:53