build.xml 中缺少类引用

发布于 2024-07-26 16:41:28 字数 289 浏览 3 评论 0原文

当我给 ant myproject-war 时,出现以下错误。 有人可以帮忙吗?

BUILD FAILED
C:\Documents and Settings\personal\Desktop\project files\myproject\bu
ild.xml:167: taskdef A class needed by class org.apache.jasper.JspC cannot be fo
und: javax/servlet/ServletContext

When I gave ant myproject-war, I got the following error. Can anyone help please?

BUILD FAILED
C:\Documents and Settings\personal\Desktop\project files\myproject\bu
ild.xml:167: taskdef A class needed by class org.apache.jasper.JspC cannot be fo
und: javax/servlet/ServletContext

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

高速公鹿 2024-08-02 16:41:28

必须将包含 javax.servlet.ServletContext 的 JAR 添加到您的 CLASSPATH 中。

Gotta add a JAR containing javax.servlet.ServletContext to your CLASSPATH.

死开点丶别碍眼 2024-08-02 16:41:28

检查您的清单和类路径。 他们可能不包括必要的罐子。

例如: classpathref="some_classpath" 可以放在 javac 标记中,其中 some_classpath 等于

<path id="some_classpath">
    <pathelement location="${someJar.jar}"/>
    <pathelement location="${another.jar}"/>
</path>

另外,您的 jar 的清单应该具有类似以下内容:

<manifest>
    <attribute name="Class-Path" value="../lib/another.jar ../lib/someJar.jar"/>
</manifest>

Check your manifest and classpath. They might not be including the necessary jar.

For instance: classpathref="some_classpath" could go in the javac tag, where some_classpath equals

<path id="some_classpath">
    <pathelement location="${someJar.jar}"/>
    <pathelement location="${another.jar}"/>
</path>

Also, you jar's manifest should have something like:

<manifest>
    <attribute name="Class-Path" value="../lib/another.jar ../lib/someJar.jar"/>
</manifest>
幻梦 2024-08-02 16:41:28

在ant中可以定义新的任务(taskdef)。 其中一些任务需要您将 java 库放入 ant 的类路径中。 这可以通过将适当的 jar 复制到 ant 安装的 lib/ext 目录中来实现。

In ant new tasks can be defined (taskdef). Some of these tasks need you to put java-libraries into the classpath of ant. That can be realized by copying the appropriate jar into the lib/ext-directory of the ant-installation.

十年九夏 2024-08-02 16:41:28

您需要在类路径中为运行包含 javax.servlet.ServletContext 的 JspC 的目标提供一个 jar。 因此,例如,如果您使用 Tomcat,则 servlet-api.jar 可能就是您正在寻找的 jar。 如果您正在使用 GWT,gwt-user.jar 可能就是 jar。 取决于您的具体情况。

You need a jar in your classpath for the target that's running JspC that contains javax.servlet.ServletContext. So, for example, if you're using Tomcat, servlet-api.jar might be the jar you're looking for. If you're doing GWT, gwt-user.jar might be the jar. Depends on your context.

活泼老夫 2024-08-02 16:41:28

您正在使用具有核心 API 不支持的依赖项的 Ant 任务。

来自文档

Ant支持一些可选的
任务。 可选任务是一个任务
这通常需要一个外部
库来运行。 可选的
任务被打包在一起
Ant 核心任务。

使用手册找到可选任务并添加所需的依赖到类路径。

You are using Ant tasks with dependencies not supported in the core API.

From the documentation:

Ant supports a number of optional
tasks. An optional task is a task
which typically requires an external
library to function. The optional
tasks are packaged together with the
core Ant tasks.

Use the manual to locate the optional tasks and add the required dependencies to the classpath.

永不分离 2024-08-02 16:41:28

Ant 不会在类路径中占用空格。

Ant doesn't take spaces in the classpath.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文