复合/模板在Maven Project的jar中停止工作

时间:2014-10-16 19:01:38

标签: maven jar

我有一些将在其他项目中使用的复合材料,在开发时我曾经在Eclipse IDE中创建的动态Web项目中测试它,然后将其.jar放在lib文件夹中

.jar是这样的包:

MyComponentProject
 |-- META-INF
 |    |-- resources
 |    |    `-- 
 |    |         |-- comp
 |    |         |    `-- someComposite.xhtml
 |    |         |-- template
 |    |         |    `-- someTemplate.xhtml
 |    |         |
 |    |-- faces-config.xml
 |    `-- MANIFEST.MF

这里是一个测试页面:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:libcomp="http://java.sun.com/jsf/composite/comp"
                xmlns:libcompAP="http://java.sun.com/jsf/composite/comp_ap"
                template="/templates/template_blank.xhtml">


   <ui:define name="inc_act">
        <ui:include src="/comp/compActions.xhtml" />
    </ui:define>

这种方式工作正常,但现在我必须使用Maven制作一个真正的测试项目。

新项目已经创建并且在第一次运行时工作正常,但是当我开始在主测试页面中添加更多复合材料时,我开始从其中一个复合材料中获得以下错误:

javax.servlet.ServletException: /index.xhtml @157,32 <libcomp:compActions>
  Tag Library supports namespace: http://java.sun.com/jsf/composite/comp,
    but no tag was defined for name: compActions

起初我以为我只需要把它拿出来让一切都恢复正常但是当我这样做时我开始从模板中收到错误:

javax.servlet.ServletException:
  /index.xhtml @8,61 <ui:composition template="/templates/template_blank.xhtml">
    Invalid path : /templates/template_blank.xhtml

我不知道发生了什么......模板总是在同一个地方。我无法弄清楚它为什么会工作一段时间然后现在停止找到模板....现在我无法让它再次运作!

有什么想法可以吗?

我将.jar再次放入动态网络项目中并且可以正常工作,所以我认为这根本不是一个糟糕的包裹问题。

我使用的是JAVA 7,JBoss EAP 6.3,JSF 2.1和Primefaces 5.0。

1 个答案:

答案 0 :(得分:0)

我发现发生了什么并回来分享,可能对其他人有用......

我发现问题只出现在我的Eclipse worksoace中“MyComponentProject”被删除时,为了让它再次运行我只需要关闭“MyComponentProject”项目。

我不知道其原因的解释,问题首先发生在我发现问题并让项目再次进行调试然后一切都搞砸了。