gpt4 book ai didi

java - 从 Eclipse 创建的 ant 脚本生成 Javadoc

转载 作者:太空宇宙 更新时间:2023-11-04 15:23:41 25 4
gpt4 key购买 nike

我正在尝试制作一个 ant 脚本来为我的项目创建一个发布包。我首先使用 Eclipse gui 中的“生成 Javadoc”命令生成 Javadoc ant 脚本。

生成的脚本如下

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="javadoc">
<target name="javadoc">
<javadoc access="protected" author="true" classpath="C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\jaxb-2.2.7\lib\jaxb-impl.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\httpcomponents-client-4.2.5\lib\httpclient-4.2.5.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\httpcomponents-client-4.2.5\lib\commons-codec-1.6.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\jaxb-2.2.7\lib\jaxb-xjc.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\jaxb-2.2.7\lib\jaxb-api.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\jaxb-2.2.7\lib\jaxb-core.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\httpcomponents-client-4.2.5\lib\httpcore-4.2.4.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\httpcomponents-client-4.2.5\lib\commons-logging-1.1.1.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\commons-configuration-1.9\commons-configuration-1.9.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\jaxb-2.2.7\lib\jaxb-jxc.jar;C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\resources\libraries\commons-lang-2.6\commons-lang-2.6.jar" destdir="C:\Users\jender\Desktop\javadoc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="com.TersoSolutions.Jetstream.SDK.XML.Events.LogicalDeviceAddedEvent,com.TersoSolutions.Jetstream.SDK.XML.Model.GetConfigurationResponse,com.TersoSolutions.Jetstream.SDK.XML.Model.ConfigureResponse,com.TersoSolutions.Jetstream.SDK.XML.Events.ObjectEvent,com.TersoSolutions.Jetstream.SDK.XML.Events.CommandQueuedEvent,com.TersoSolutions.Jetstream.SDK.XML.Model.CommandResponse,com.TersoSolutions.Jetstream.SDK.Application.User.DeviceSpecificCommands.TS,com.TersoSolutions.Jetstream.SDK.XML,com.TersoSolutions.Jetstream.SDK.Application.User,com.TersoSolutions.Jetstream.SDK.Application.Events,com.TersoSolutions.Jetstream.SDK.XML.Events.SensorReadingEvent,com.TersoSolutions.Jetstream.SDK.XML.Events.DeviceFailureEvent,com.TersoSolutions.Jetstream.SDK.XML.Model.RemoveEventsResponse,com.TersoSolutions.Jetstream.SDK.XML.Events.HeartbeatEvent,com.TersoSolutions.Jetstream.SDK.XML.Model.GetDeviceDefinitionsResponse,com.TersoSolutions.Jetstream.SDK.XML.Events.LogicalDeviceRemovedEvent,com.TersoSolutions.Jetstream.SDK.XML.Events.CommandCompletionEvent,com.TersoSolutions.Jetstream.SDK.XML.Events.LogEntryEvent,com.TersoSolutions.Jetstream.SDK.Application,com.TersoSolutions.Jetstream.SDK.XML.Events.DeviceRestoreEvent,com.TersoSolutions.Jetstream.SDK.XML.Model.GetPoliciesResponse,com.TersoSolutions.Jetstream.SDK.XML.Model.GetEventsResponse,com.TersoSolutions.Jetstream.SDK.XML.Events.AggregateEvent" source="1.7" sourcepath="C:\Eclipse\workspace\JetstreamSDK-Java\JetstreamSDK-Java\src" splitindex="true" use="true" version="true"/>
</target>
</project>

在继续之前,我决定测试该脚本,但我无法让它正常运行。我尝试使用以下命令运行脚本

ant javadoc -buildfile javadoc_protected.xml 

ant javadoc -buildfile javadoc_protected.xml C:\Program Files\Java\jdk1.7.0_25\bin\javadoc.exe

ant javadoc -buildfile javadoc_protected.xml "C:\Program Files\Java\jdk1.7.0_25\bin\javadoc.exe"

在上述方法不起作用后,我通读了 http://ant.apache.org/manual/Tasks/javadoc.html页面并尝试过

ant javadoc -buildfile javadoc_protected.xml -executable C:\Program Files\Java\jdk1.7.0_25\bin\javadoc.exe

但我还是没有运气。我对 Ant 非常缺乏经验,如果有人能解释我做错了什么,我将不胜感激。

最佳答案

如果您发布收到的错误消息,它将有很大帮助......

在没有看到错误的情况下,这是我的建议:

1) 将构建文件放入名为“build.xml”的文件中

2) 在放置 build.xml 文件的目录中,尝试执行 ant javadoc(在命令窗口中 -“开始”菜单,执行,cmd-)

3) 如果您收到一条错误消息“无法运行程序 javadoc.exe”,则说明您的系统路径中没有 javadoc.exe。因此,要将 JDK 添加到路径(假设您使用的是 Windows 操作系统),您需要打开命令窗口并键入

set Path="C:\Program Files\Java\jdk1.7.0_25\bin";%Path%

不要忘记引号!

4)执行

ant javadoc 

在 build.xml 文件的目录中,仅此而已!

这是一个简单的 build.xml 我用来测试它:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="javadoc">
<target name="javadoc">
<javadoc access="protected" author="true" sourcepath="C:\workspace\ZeSwing\src" destdir="C:\workspace\ZeSwing\docs"/>
</target>
</project>

希望对您有帮助! (或者也许,考虑到您的帖子日期......您已经在其他地方找到了解决方案)

关于java - 从 Eclipse 创建的 ant 脚本生成 Javadoc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20100911/

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