Maven 在包之间共享自定义JSTL标记库
我有许多使用公共jstl标记库(c、fmt、fn等)的Liferay portlet war项目和一个自定义库 目前,我已经在每个项目的WEB-INF/tld文件夹中放置了tld的副本Maven 在包之间共享自定义JSTL标记库,maven,liferay,jstl,taglib,Maven,Liferay,Jstl,Taglib,我有许多使用公共jstl标记库(c、fmt、fn等)的Liferay portlet war项目和一个自定义库 目前,我已经在每个项目的WEB-INF/tld文件夹中放置了tld的副本 project1 src.main.webapp.WEB-INF.tld c.tld custom.tld fmt.tld ... project2 src.main.webapp.WEB-INF.tld c.tld
project1
src.main.webapp.WEB-INF.tld
c.tld
custom.tld
fmt.tld
...
project2
src.main.webapp.WEB-INF.tld
c.tld
custom.tld
fn.tld
...
偶尔我们会对自定义库进行更新,这意味着更新所有副本
我如何创建一个能够为我保存所有这些标记库的依赖项项目
它是否像一个带有src/main/resources/WEB-INF/tld文件夹的空项目一样简单?这似乎是一个可行的解决方案 创建一个新的maven项目taglib proj,打包为jar 将标记库从项目1和项目2移动到标记库项目中
taglib-proj
src.main.resorces
tld
c.tld
custom.tld
fmt.tld
fn.tld
使用resources文件夹作为位置库,从project1和project2的web.xml中引用这些标记库
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>myCustomLib</taglib-uri>
<taglib-location>/tld/custom.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/tld/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fn</taglib-uri>
<taglib-location>/tld/fn.tld</taglib-location>
</taglib>
...
</jsp-config>
http://java.sun.com/jsp/jstl/core
/tld/c.tld
myCustomLib
/tld/custom.tld
http://java.sun.com/jsp/jstl/fmt
/tld/fmt.tld
http://java.sun.com/jsp/jstl/fn
/tld/fn.tld
...