gpt4 book ai didi

java - 为什么 Jars 被排除在 Enunciate 的部署之外?

转载 作者:行者123 更新时间:2023-12-02 00:56:09 26 4
gpt4 key购买 nike

我正在使用Enunciate要构建原型(prototype) REST api,需要包含一个包含自定义代码的 jar 作为库。

我的 Ant 脚本如下所示:

<!--include all jars-->
<path id="en.classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>

<!--define the task-->
<taskdef name="enunciate" classname="org.codehaus.enunciate.main.EnunciateTask">
<classpath refid="en.classpath" />
</taskdef>

<mkdir dir="${dist}" />

<enunciate dir="${src}" configFile="${basedir}/enunciate.xml">
<include name="**/*.java" />
<classpath refid="en.classpath"/>
<export artifactId="spring.war.file" destination="${dist}/${war.name}" />
</enunciate>

问题是我的自定义 jar 被排除在 WAR 文件之外。有必要编译 enunciate 带注释的类,因此 jar 在编译时显然位于类路径上,但 enunciate 未能将其包含在发行版中。我还注意到 enunciate 所需的几个 jar 没有包含在 WAR 文件中。

为什么它们被排除以及如何修复它?

最佳答案

我从未使用过 enunciate,但作为快速破解,您可以将 jar 添加到 war 中:

<jar jarfile="${dist}/${war.name}" update="true">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</jar>

注意:您可能希望将 jar 添加到 WEB-INF/lib 目录,而不是根目录。

我猜测 enunciate 会最小程度地干扰您自己的构建过程,因为您最清楚要在 jar 文件中放入什么内容。

关于java - 为什么 Jars 被排除在 Enunciate 的部署之外?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/162874/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com