2

我在 JSP 编译期间遇到了 jspc-maven-plugin 版本 2-0 alpha 3 的问题。我的大多数 JSP 编译得很好,但有一些依赖于我在 POM 中列出的 JAR 依赖项 (dam_classes) 中包含的类:

<plugin>
    <groupId>org.codehaus.mojo.jspc</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <version>2.0-alpha-3</version>
    <executions>
        <execution>
            <goals>
                 <goal>compile</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
                <sources>
                  <directory>${basedir}/target/${project.build.finalName}</directory> 
                  <includes> 
                    <include>**/*.jsp</include> 
                  </includes> 
                </sources>
                <verbose>1</verbose> 
                <inputWebXml>${basedir}/target/${project.build.finalName}/WEB-INF/web.xml</inputWebXml>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>com.fmr.AP100141.com.documentum</groupId>
            <artifactId>dam_classes</artifactId>
            <version>6.7.2000.0038</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo.jspc</groupId>
            <artifactId>jspc-compiler-tomcat6</artifactId>
            <version>2.0-alpha-3</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

    </dependencies>
</plugin>

当我运行 mvn -X package 并检查调试输出时,我看到以下消息:

[ERROR] An error occurred at line: 31 in the jsp file: /custom/dam/environment/preferences/general/app_general_preferences.jsp
[ERROR] com.documentum.web.form.control cannot be resolved to a type
[ERROR] 28: <dmf:label nlsid="MSG_START_SECTION_HEADER"/></td>
[ERROR] 29: <td class="defaultcolumnspacer leftAlignment" valign="top" >:&nbsp;</td>
[ERROR] 30: <td class="leftAlignment" valign="top" style="padding-left: 10px">
[ERROR] 31: <dmf:datadropdownlist name="<%=AppGeneralPreferences.CONTROL_SECTIONS%>"  tooltipnlsid="MSG_START_SECTION_HEADER" postfixassociatedlabelnlsid="MSG_START_SECTION_DESCRIPTION">
[ERROR] 32: <dmf:dataoptionlist>
[ERROR] 33: <dmf:option datafield="id" labeldatafield="label"/>
[ERROR] 34: </dmf:dataoptionlist>

即使 com.documentum.web.form.control 包显式位于类路径上(同样,根据调试输出),它似乎也无法找到它:

[调试] (f) 类路径元素 = [C:\Users\a392841\workspace\eContent-damtop\eContent-damtop-war\target\classes, C:\Users\a392841\workspace\eContent-damtop\eContent-damtop-war ....\eContent-artifacts\eContent-artifacts-common\target\fid_commons.jar, C:\Users\a392841\workspace\eContent-damtop\eContent-damtop-war ....\eContent-artifacts\eContent- artifacts-bof\target\eContent-bof-all.jar, C:\Users\a392841.m2\repository\com\fmr\AP100141\com\documentum\dam_classes\6.7.2000.0038\dam_classes-6.7.2000.0038.jar , . ..

我什至仔细检查了 dam_classes-6.7.2000.0038.jar 以确保它确实包含在 JSP 的该行中引用的包和类。

作为参考,这里是引用该类的 JSP 和关联的标记库。

JSP

<%
//
%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page errorPage="/wdk/errorhandler.jsp" %>
<%@ taglib uri="/WEB-INF/tlds/dmform_1_0.tld" prefix="dmf" %>
<%@ taglib uri="/WEB-INF/tlds/dmformext_1_0.tld" prefix="dmfx" %>
<%@ page import="com.fmr.fwp.webtop.preferences.general.AppGeneralPreferences,
com.documentum.webcomponent.environment.preferences.general.GeneralPreferences" %>
<%@ page import="com.documentum.web.common.AccessibilityService" %>
<html>
<head>
<dmf:webform/>
</head>
<body class='contentBackground'>
<dmf:form autofocusneeded='true'>
<table  cellspacing=0 cellpadding=0 border=0>
<tr>
<td colspan="3" class="spacer" height="10">&nbsp;</td>
</tr>
<tr height="43">
<td class="fieldlabel rightAlignment nowrap" valign="top" scope="row" >
<% if (AccessibilityService.isAllAccessibilitiesEnabled())
{ %>
<dmf:button onclick="doNothing" src="icons/info.gif" tooltipnlsid="MSG_MESSAGE" runatclient="true"/>
<script type="text/javascript"> function doNothing(){ return false;} </script>
<%  } %>
<dmf:label nlsid="MSG_START_SECTION_HEADER"/></td>
<td class="defaultcolumnspacer leftAlignment" valign="top" >:&nbsp;</td>
<td class="leftAlignment" valign="top" style="padding-left: 10px">
<dmf:datadropdownlist name="<%=AppGeneralPreferences.CONTROL_SECTIONS%>"  tooltipnlsid="MSG_START_SECTION_HEADER" postfixassociatedlabelnlsid="MSG_START_SECTION_DESCRIPTION">
<dmf:dataoptionlist>
<dmf:option datafield="id" labeldatafield="label"/>
</dmf:dataoptionlist>
</dmf:datadropdownlist>
<dmf:label nlsid="MSG_START_SECTION_DESCRIPTION" cssclass="noteWithoutPadding"/>
</td>
</tr>
<tr>
<tr height="30"><td colspan=3><HR></td></tr>
<tr height="43">
<td class="fieldlabel rightAlignment" valign="top" scope="row"  >
<dmf:label cssclass='fieldlabel' nlsid="MSG_CHOOSE_THEME_HEADER"/>
</td>
<td class="defaultcolumnspacer leftAlignment" valign="top"  >:&nbsp;</td>
<td class="leftAlignment" valign="top"   style="padding-left: 10px">
<dmf:datadropdownlist name="<%=AppGeneralPreferences.CONTROL_RESOURCE_FOLDERS%>" tooltipnlsid="MSG_CHOOSE_THEME_HEADER" postfixassociatedlabelnlsid="MSG_CHOOSE_THEME_DESCRIPTION">
<dmf:dataoptionlist>
<dmf:option datafield="value" labeldatafield="value"/>
</dmf:dataoptionlist>
</dmf:datadropdownlist>
<dmf:label nlsid="MSG_CHOOSE_THEME_DESCRIPTION"  cssclass='noteWithoutPadding'/>
</td>
</tr>
<tr><td colspan=3>&nbsp;</td></tr>
<!-- CHANGES DISPLAY SHOW ALL OBJECTS AND SHOW ALL VERSIONS -->

<dmf:panel name="displayHiddenObjectPanel">
<tr>
<td colspan="3" class="spacer" height="20">&nbsp;</td>
</tr>
<tr>
<td class="fieldlabel" align="right" valign="top" scope="row">
<dmf:label nlsid='MSG_SHOW_ALL_OBJECTS'/>
</td>
<td class="defaultcolumnspacer" align="left" valign="top">&nbsp;</td>
<td align="left" valign="top">
<dmf:checkbox name='<%=AppGeneralPreferences.CONTROL_SHOW_ALL_OBJECTS_OPTION%>'
tooltipnlsid='MSG_ALL_OBJECTS'/><dmf:label nlsid='MSG_ALL_OBJECTS'/>
</td>
</tr>
</dmf:panel>

<dmf:panel name="displayHiddenObjectPanel">
<tr>
<td colspan="3" class="spacer" height="20">&nbsp;</td>
</tr>
<tr>
<td class="fieldlabel" align="right" valign="top" scope="row">
<dmf:label nlsid='MSG_SHOW_ALL_VERSIONS'/>
</td>
<td class="defaultcolumnspacer" align="left" valign="top">&nbsp;</td>
<td align="left" valign="top">
<dmf:checkbox name='<%=AppGeneralPreferences.CONTROL_SHOW_ALL_VERSION_OPTION%>'
tooltipnlsid='MSG_ALL_VERSIONS'/><dmf:label nlsid='MSG_ALL_VERSIONS'/>
</td>
</tr>
</dmf:panel>
<!--- CHANGES DISPLAY ALL OBJECTS AND VERSIONS ENDS -->




<tr><td colspan=3>&nbsp;</td></tr>
<dmf:panel name="enableDragDropPluginPanel">
<tr height="57">
<td class="fieldlabel rightAlignment nowrap" valign="top" scope="row"  >
<dmf:label nlsid="MSG_DRAG_DROP_PLUGIN_OPTION"/>
</td>
<td class="defaultcolumnspacer leftAlignment" valign="top"  >:&nbsp;</td>
<td class="leftAlignment" valign="top"  style="padding-left: 10px">
<dmf:checkbox name='<%=AppGeneralPreferences.CONTROL_DRAG_DROP_PLUGIN_OPTION%>'
tooltipnlsid="MSG_DRAG_DROP_PLUGIN_OPTION"/><dmf:label nlsid="MSG_DRAG_DROP_PLUGIN_OPTION_DESCRIPTION"/>
<dmf:label nlsid="MSG_DRAG_DROP_NOTE"  cssclass='noteWithoutPadding'/>
</td>
</tr>
</dmf:panel>
<%--ole scan panel --%>
<dmf:panel name="oleScanPanel">
<tr>
<td class="fieldlabel rightAlignment nowrap" valign="top" scope="row"  >
<dmf:label nlsid="MSG_OLE_SCAN_ENABLE"/>
</td>
<td class="defaultcolumnspacer leftAlignment" valign="top"  >:&nbsp;</td>
<td class="leftAlignment" valign="top"  style="padding-left: 10px">
<dmf:checkbox name='<%=AppGeneralPreferences.CONTROL_OLE_SCAN_ENABLE%>'
tooltipnlsid="MSG_OLE_SCAN_ENABLE"/><dmf:label nlsid="MSG_OLE_SCAN_ENABLE_DESCRIPTION"/>
<dmf:label nlsid="MSG_OLE_SCAN_NOTE"  cssclass='noteWithoutPadding'/>
</td>
</tr>
</dmf:panel>
<tr>
<td class="fieldlabel rightAlignment nowrap" valign="top" scope="row">
<dmf:label cssclass="fieldlabel" nlsid="MSG_ACCESSIBILITY_OPTION"/>
</td>
<td class="defaultcolumnspacer leftAlignment" valign="top">:&nbsp;</td>
<td class="leftAlignment" valign="top"  style="padding-left: 10px">
<dmf:checkbox name='<%=AppGeneralPreferences.CONTROL_ACCESSIBILITY_OPTION%>'
tooltipnlsid="MSG_ACCESSIBILITY_OPTION" postfixassociatedlabelnlsid="MSG_ACCESSIBILITY_OPTION_NOTE"/>
<dmf:label nlsid="MSG_ACCESSIBILITY_OPTION_DESCRIPTION"/>
<dmf:label nlsid="MSG_ACCESSIBILITY_OPTION_NOTE"  cssclass='noteWithoutPadding'/>
</td>
</tr>
<dmf:panel name="restorePreferencesPanel">
<tr height="30">
<td colspan=3><HR></td>
</tr>
<tr>
<td class="defaultcolumnspacer leftAlignment" valign="top" colspan="2"></td>
<td class="leftAlignment" valign="top" style="padding-left: 10px">
<dmf:link name='restorePreferences' onclick="onClickRestorePreferences"
nlsid="MSG_RESTORE_PREFERENCES" postfixassociatedlabelnlsid="MSG_RESTORE_TO_DEFAULT_PREFERENCES" cssclass='miniButton'/>
<dmf:label nlsid='MSG_RESTORE_TO_DEFAULT_PREFERENCES'/>
</td>
</tr>
</dmf:panel>
</table>
</dmf:form>
</body>
</html>

TLD(适用于相关类的代码段)

   <tag>
      <name>datadropdownlist</name>
      <tagclass>com.documentum.web.form.control.databound.DataDropDownListTag</tagclass>
      <bodycontent>jsp</bodycontent>
      <attribute>
         <name>id</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            ID for the control. The ID is generated by the framework. You
            can also set the ID in the JSP.
         </description>
      </attribute>
      <attribute>
         <name>name</name>
         <required>true</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets the name for the control. Named controls are cached on the 
            server. Controls with the same name are automatically indexed.
         </description>
      </attribute>
      <attribute>
         <name>value</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets the currently selected value.
         </description>
      </attribute>
      <attribute>
         <name>enabled</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets whether the control is enabled.
         </description>
      </attribute>
      <attribute>
         <name>visible</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets whether the control is rendered as visible or hidden.
         </description>
      </attribute>
      <attribute>
         <name>width</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Width of the data drop-down list control
         </description>
      </attribute>
      <attribute>
         <name>query</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Displays a query or recordset as a drop down list. Use the
            dataoptionlist tag within datadropdownlist for databound values. 
            Use an option tag within datadropdownlist for static output. The DQL 
            query that is passed to the data provider has the following form: 
            query="select r_object_id, user_name from dm_user where user_name 
            like 'a%' "
         </description>
      </attribute>
      <attribute>
         <name>style</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            A cascading style sheet rule enclosed in quotation marks; for 
            example: style="{COLOR: darkmagenta; TEXT-DECORATION: underline}"
         </description>
      </attribute>
      <attribute>
         <name>cssclass</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets the cascading style sheet class that is used to format the control.
         </description>
      </attribute>
      <attribute>
         <name>onchange</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets the event that is fired when the control is changed by the 
            user. The onchange event handler cannot run on the client 
            (runatclient cannot be true). The onchange event is not handled 
            immediately. It is handled on the server only when the form is 
            submitted (for example, by an onclick event).
         </description>
      </attribute>
      <attribute>
         <name>onselect</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets the event that is fired when the user selects the control, such 
            as an option in a list. The onselect event is handled immediately, 
            either on the server (when runatclient=="false") or on the client 
            (when runatclient=="true").
         </description>
      </attribute>
      <attribute>
         <name>runatclient</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Specifies that the event should run on the client, not the server. 
            The onchange event cannot run on the client.
         </description>
      </attribute>
      <attribute>
         <name>focus</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Set to true to enable the control to accept focus.
         </description>
      </attribute>
      <attribute>
         <name>tabindex</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            TBD.
         </description>
      </attribute>
      <attribute>
         <name>tooltip</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets the string that will be displayed on browser mouseover.
         </description>
      </attribute>
      <attribute>
         <name>tooltipnlsid</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Sets the NLS key to look up a localized tooltip string.
         </description>
      </attribute>
      <attribute>
         <name>autocompleteenabled</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Enables (True) or disables (False) autocompletion on the control.
            Default is True.
         </description>
      </attribute>
      <attribute>
         <name>autocompleteid</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <description>
            Key that is used to store the autocomplete list in the user 
            preferences. You can set the same ID on two text controls, for 
            example, if they share the same set of suggestions. If the control
            has no ID specified, the ID will be generated based on the form 
            id and text control name, in the form consisting of 
            formid_controlid. For docbaseattribute controls that render a text 
            control, an ID is generated using the attribute name, for example, 
            keyword or title.
         </description>
      </attribute>
      <attribute>
          <name>maxautocompletesuggestionsize</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>
             Number of matching suggestions to display to the user. Default
             is 10.
          </description>
      </attribute>
      <attribute>
          <name>prefixassociatedlabelnlsid</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>
            Specified label NLS string is prefixed to the control's
            existing title, helps accessibility users in obtaining
            contextual information.
          </description>
      </attribute>
      <attribute>
          <name>postfixassociatedlabelnlsid</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>
            Specified label NLS string is postfixed to the control's
            existing title, helps accessibility users in obtaining
            contextual information.
          </description>
      </attribute>
   </tag>

我觉得我已经用尽了一切,并且很困惑为什么 JSPC 插件无法找到提到的包,即使它明确地位于类路径上。任何意见或反馈将不胜感激。我对 Maven 比较陌生,但这是我遇到的第一个真正的难题。

谢谢。-K

4

0 回答 0