简体   繁体   English

使用Play Framework JAR子项目

[英]Using Play Framework JAR subproject

I'm working with multiple Java Play projects and I want to work with my subproject in a different way than I do now but I don't know how to do that. 我正在处理多个Java Play项目,并且我想以与现在不同的方式来处理子项目,但是我不知道该怎么做。 I'm working with three projects, let's call them A, B and Sub. 我正在处理三个项目,我们称它们为A,B和Sub。 Sub is my subproject and it used in A and B in a different way, but both projects need Sub. Sub是我的子项目,它在A和B中的使用方式不同,但是两个项目都需要Sub。 At the moment, I have two times the code of Sub in: [A-Project]/modules/sub [B-Project]/modules/sub 此刻,我在[A-Project] / modules / sub [B-Project] / modules / sub中有两次Sub的代码。

Twice the same code which needs to be synchronized. 两次需要同步的相同代码。 I'd like to pack my subproject just in an archive like a JAR-file and include it in both projects A and B as a library. 我想将子项目打包在一个JAR文件之类的存档中,并将其作为库包含在项目A和B中。 Is there a way to do that or do I have to work with two different folders for the same project? 有没有办法做到这一点,或者我必须为同一项目使用两个不同的文件夹? :/ :/

Thank you for your help! 谢谢您的帮助!

I would consider having Sub be placed within its own package, and then having both Project A and Project B import that package. 我会考虑将Sub放在其自己的程序包中,然后让Project A和Project B都导入该程序包。 This will only be efficient if Sub is being used in generally the same way in both A and B. If Sub is being modified that much and you really don't want to Override too much, you might be better off placing a different version of Sub in each project. 只有在Sub和A和B中使用Sub的方式大致相同时,这才有效。如果Sub的修改量很大,并且您确实不想过多地覆盖,则最好放置其他版本的Sub子在每个项目。

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

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