开发者

In Eclipse link two dynamic web projects to another project working as a library

Is there a way to split up a Dynamic Web Project in Eclipse into two libraries and link them up properly?

So, I'd like to have a library project and two other applications specific web projects. Both using the library project.

I looked into the "references" option in Eclipse to link projects up but didn't work as intended. I also looked into Web Fragment feature but that didn't let me define servlets which need to be defined in the lib project as well as the servlets will be the same for both projects.

Also, is there a way to overlay content from the lib project by content defined in each project? Example:

-Lib
    -WEB-INF
        -img.jpg


-AppProjectA  (using Lib project)
    -WEB-INF
        -img.jpg

I'd like to be able to use the Lib project in AppProjectA and replace the img.jpg file imported from the lib project with the one defined in AppProjectA.

I looked into Maven overlay but that's a bit 开发者_开发问答too crazy for what I need to do. I also prefer Ant script over Maven. Any ideas on how to accomplish what I need to do here?


I guess with sufficiently clever Ant you probably can achieve what you want, but I don't know of anything off the shelf. However do you really need to do this? Can you get the level of reuse by just referring to resources from the other web app?

Suppose you deploy them both, each with their own context root.

A page from appA can refer to appB

/appB/imgages/img.jpg

For common code, put it in a library JAR project, packaging the JAR in the root of the EAR, or in WEB-INF/lib of each app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜