Organization of the project in

I have created several web applications that use the same static files (css, js, images). When I use svn for source control, I use an external repository (svn: externals) to add files to the current project. For instance:

- Project_1 
---- Webapp 
-------- Static (external to static repo) 
- Project_2 
---- Webapp 
-------- Static (external to static repo)

      

I could easily use it in my webpages by adding a link like / static / ...

But now our company has moved to a permanent job. How can I support the existing structure?

We are also using maven, I think to pack these files into a jar and use as a dependency, but then my editor (idea) doesn't see that this dependency is js scripts and styles. And I need to repackage and deploy the jar file when making minor changes.

How to use maven correctly?

+2


a source to share


3 answers


For a Maven based solution you can use WAR Overlays , sharing shared resources across multiple web applications is exactly what overlays.



+2


a source


Perforce supports defining multiple mappings from the depot on your hard drive as part of the client specification. For example, you can 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 will not handle multiple mapping of a shared static folder situation on its own, you will need to use links / symlinks in your filesystem to get the behavior you want. Warning, however, make sure that only one of the static shared folders is actually managed through Perforce. It can get a little confused if resources are changed from under it without being aware of the changes.

Indeed, you are probably better off (if you can) - having one workspace / client spec per project - one for proj1 and one for proj2, each with their own mappings to a shared static folder. If you can structure things properly and just use maven to create each "project", everything will go smoothly.

+3


a source


You seem to have a couple of options called overlays:

a) Maven overlays as @Pascal suggests . Then you, for example @Goyuix , advise checking static content from Perforce.

b) Perforce overlays which will allow you to have two different client workspaces / specs, one for each project and each importing static content to the expected location on the filesystem. This is the closest match to the reporting structure you used earlier.

0


a source







All Articles