简体   繁体   English

使用Maven创建Web应用程序框架

[英]Create web application framework with Maven

we are trying to develop a web application framework and build implementatins on top of it. 我们正在尝试开发一个Web应用程序框架并在其上构建实现。 This framwork will be versioned in SVN, live its own life in parallel to those implementations. 这个框架将在SVN中进行版本化,与这些实现并行生活。 It will have lots of spring config files, security config and so on. 它将有很多spring配置文件,安全配置等等。 We would like to use those in those implementations. 我们想在那些实现中使用它们。

What structure should such an project have? 这样的项目应该有什么结构? Keep everything together? 保持一切? Link particular folers (implementations) in "svn: externals"? 链接“svn:externals”中的特定folers(实现)? We would like to use Maven, and create an archetype for those implementations, but is it possible to update the archetype after it has been changed in implementation applications? 我们想使用Maven,并为这些实现创建一个原型,但是可以在实现应用程序中更改原型之后更新原型吗?

Regards, 问候,

This is a good example : 这是一个很好的例子:

http://www.sonatype.com/books/mvnex-book/reference/web.html http://www.sonatype.com/books/mvnex-book/reference/web.html

Also this book is very useful resource when starting with maven 当从maven开始时,这本书是非常有用的资源

I found this also : 我也发现了这个:

http://www.avajava.com/tutorials/lessons/how-do-i-create-a-web-application-project-using-maven.html http://www.avajava.com/tutorials/lessons/how-do-i-create-a-web-application-project-using-maven.html

I'd suggest you create your framework project as a simple jar project to include in your implementation, which would be war projects. 我建议您将框架项目创建为一个简单的jar项目,以包含在您的实现中,这将是战争项目。 For the Spring config files you have three options then: 对于Spring配置文件,您有三个选项:

  1. Package them into your framework jar. 将它们打包到您的框架jar中。 This would make it hard for the implementations to customize it. 这将使实现很难定制它。 I would not recommend it, unless your configuration is definitively fixed. 我不推荐它,除非你的配置明确修复。

  2. Use svn: externals. 使用svn:externals。 I have not much experience with that, but I think dependencies between svn repositories would be hard to manage. 我对此没有多少经验,但我认为svn存储库之间的依赖关系很难管理。

  3. Maintain these configuration files per implementation. 每个实现维护这些配置文件。 So, an archetype would help to get started with an initial configuration. 因此,原型将有助于开始初始配置。 Then maintain these configuration files as your framework evolves. 然后在框架发展时维护这些配置文件。 This is what we do most of the time. 这是我们大部分时间都在做的事情。 The good thing about Spring configuration is that it often rarely needs to be touched once you are confident with it. 关于Spring配置的好处是,一旦你对它有信心,通常很少需要触摸它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM