项目组织有效
我创建了几个使用相同静态文件(css、js、图像)的 Web 应用程序。 当我使用svn进行版本控制时,我使用外部存储库(svn:externals)将文件添加到当前项目中。 例如:
- Project_1
---- Webapp
-------- Static (external to static's repo)
- Project_2
---- Webapp
-------- Static (external to static's repo)
我可以通过添加像 /static/ 这样的链接轻松地在他们的网页中使用它......
但现在我们公司已经转向 perforce。 我怎样才能支持当前的结构?
我们还使用maven,我想将这些文件打包为jar并用作依赖项,但后来我的编辑器(想法)没有看到这个依赖项是js脚本和样式。 当创建较小的更改时,我需要重新打包和部署 jar 文件。
如何正确使用maven?
I created several web applications that use the same static files (css, js, images).
When I use svn for version control, I use an external repository (svn: externals) to add files to the current project.
For example:
- Project_1
---- Webapp
-------- Static (external to static's repo)
- Project_2
---- Webapp
-------- Static (external to static's repo)
I could easily use it in their web pages by adding a link like /static/ ...
But now our company has moved to perforce.
How can I support the current structure?
We also use maven, I think to pack these files as a jar and use as a dependency, but then my editor (idea) does not see that this dependence are js-scripts and styles.
And i need to repackage and deploy jar file when create minor changes.
How to use maven correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于基于 Maven 的解决方案,您可以使用 WAR Overlays,跨多个 Web 应用程序共享公共资源正是覆盖的用途。
For a Maven based solution, you could use WAR Overlays, sharing common resources across multiple web applications is exactly what overlays are for.
Perforce 支持定义从软件仓库到硬盘驱动器的多个映射,作为客户端规范的一部分。例如,您可以设置以下内容:
Perforce 本身不会处理共享静态文件夹情况的多个映射,您必须在文件系统中使用连接/符号链接来获得您想要的行为。不过请注意,请确保只有一个共享静态文件夹实际上是通过 Perforce 进行管理的。如果资源在它不知道的情况下从它下面被更改,它可能会变得有点脾气暴躁。
实际上,您可能会更好(如果可以的话) - 每个项目都有一个工作区/客户端规范 - 一个用于 proj1,一个用于 proj2,每个项目都有自己的到共享静态文件夹的映射。如果你可以适当地构建事物并使用 Maven 来构建每个“项目”,事情就会进展得更顺利。
Perforce has support for defining multiple mappings from the depot to your hard drive as part of the client spec. You could, for example, set the following:
Perforce won't handle multiple mapping of the shared static folder situation by itself, you will have to use junctions/symlinks in your file system to get the behavior you want. A word of caution though, make sure only one of the shared static folders is actually managed through Perforce. It can get slightly grumpy if resources get changed out from under it without it knowing about the changes.
Really though, you are probably better off (if you can) - having a single workspace/client spec per project - one for proj1 and one for proj2, each with their own mappings to the shared static folder. If you can structure things appropriately and just use maven to build each "project" things will go more smoothly.
看来你有几个选择,都称为覆盖:
a) Maven按照 @Pascal 建议的覆盖。然后,像 @Goyuix 这样的指令建议您从 Perforce 中签出静态内容。
b) Perforce 覆盖,这将允许您拥有两个不同的工作区/客户端规范,其中一个用于每个项目,以及每个项目中将静态内容导入到文件系统中的预期位置。这是与您之前使用的 subversion 结构最接近的匹配。
It seems you have a couple of choices, both called overlays:
a) Maven overlays as @Pascal suggests. Then you a struction like @Goyuix suggests to checkout the static content from Perforce.
b) Perforce overlays, which would allow you to have two different workspaces/client specs, one for each project, and in each import the static content into the expected place in the filesystem. This is the closest match to the subversion structure you were using before.