项目组织有效

发布于 2024-08-30 17:23:44 字数 483 浏览 3 评论 0原文

我创建了几个使用相同静态文件(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

静水深流 2024-09-06 17:23:44

对于基于 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.

韵柒 2024-09-06 17:23:44

Perforce 支持定义从软件仓库到硬盘驱动器的多个映射,作为客户端规范的一部分。例如,您可以设置以下内容:

Client Name: Sample_Maven
Client Root: c:\inetpub\wwwroot

//depot/Project_1/Webapp/... //Sample_Maven/Project_1/...
//depot/Project_2/Webapp/... //Sample_Maven/Project_2/...
//depot/Shared/static/... //Sample_Maven/static/...
... any other folder mappings you need to bring in and sync ...

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:

Client Name: Sample_Maven
Client Root: c:\inetpub\wwwroot

//depot/Project_1/Webapp/... //Sample_Maven/Project_1/...
//depot/Project_2/Webapp/... //Sample_Maven/Project_2/...
//depot/Shared/static/... //Sample_Maven/static/...
... any other folder mappings you need to bring in and sync ...

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.

烟酉 2024-09-06 17:23:44

看来你有几个选择,都称为覆盖:

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文