简体   繁体   English

多模块 JHipster 应用

[英]Multi module JHipster application

Is it possible to have a multi module Maven project using JHipster?是否可以使用 JHipster 进行多模块 Maven 项目?

At first sight seems not but I want to know if there's a way to share common classes like domain classes or repository classes among different web modules in my Project using Maven.乍一看似乎没有,但我想知道是否有一种方法可以使用 Maven 在我的项目中的不同 web 模块之间共享域类或存储库类等公共类。

Suppose to have a Web module with an HTML GUI made with Thymeleaf (no React / Angular), a classic Backoffice.假设有一个 Web 模块和一个 HTML GUI 用 Thymeleaf(无 React / Angular),一个经典的后台。

Then I want to have another web module that expose some REST API that needs for the same domain classes and the existing repository layer.然后我想要另一个 web 模块,该模块公开一些 REST API 需要相同的域类和现有的存储库层。

At first It seems that I've have to duplicate these classes and code into another JHipster application but obviously It's not the best solution.起初,我似乎不得不将这些类和代码复制到另一个 JHipster 应用程序中,但显然这不是最好的解决方案。

Without JHipster I create a multi module Maven project with 2 web modules (Backoffice + API) and a third module with these common classes packaged in a shared JAR included as dependency in the first two modules.在没有 JHipster 的情况下,我创建了一个多模块 Maven 项目,其中包含 2 个 web 模块(Backoffice + API)和第三个模块,这些通用类打包在共享 Z529E625C8C2BF37C6334AAE495A10 中作为依赖项模块包含在前两个模块中。

How (if It is possibile) can achive this with JHipster? (如果可能的话)如何使用 JHipster 实现这一目标?

Thanks谢谢

JHipster won't be able to generate what you want, it's up to you manually refactor the generated project to suit your needs and it's not difficult because JHipster puts entity classes in domain package and repositories in repository package. JHipster 将无法生成您想要的内容,这取决于您手动重构生成的项目以满足您的需求,这并不困难,因为 JHipster 将实体类放在domain package 和存储repository package 中。 You will then have to decide how you want to execute the Liquibase migrations.然后,您必须决定如何执行 Liquibase 迁移。

You can generate only backend code using --skip-client option, see command line options in doc .您只能使用--skip-client选项生成后端代码,请参阅doc 中的命令行选项

An alternative (if you are motivated) would be to write a JHipster blueprint to generate a project with the structure you want.另一种选择(如果你有动力的话)是编写一个JHipster 蓝图来生成一个具有你想要的结构的项目。

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

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