我可以在我的 Jar 文件(由 Ant 生成)中保存评论信息吗? [英] Can i save comment info in my Jar file(generated by Ant)?

查看:34
本文介绍了我可以在我的 Jar 文件(由 Ant 生成)中保存评论信息吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 Ant 将我的项目构建为 Jar 文件时,我同时生成了 javadoc.

When I build my project to a Jar file with Ant, I generate javadoc the same time.

因此,我尝试在新项目属性的javadoc 位置"中添加 javadoc 文件的位置路径,但它不起作用,即使 Eclipse 告诉我位置可能有效".

So I tried to add the javadoc files' location path in 'javadoc Location' of Properties of my new Project,it doesn't work, even if Eclipse tell me the 'Location is likely valid'.

当我在浏览器中打开它时,网址就像 file:///file:/C:/Users/topxebec/Desktop/doc/index.html,网址中有两个前缀,但在 Eclipse 中我只有 file:/C:/Users/topxebec/Desktop/doc/index.html,.

When I open it in Browser,the Url is like file:///file:/C:/Users/topxebec/Desktop/doc/index.html, there's two prefix in the url,but in the eclipse I only have file:/C:/Users/topxebec/Desktop/doc/index.html,.

我尝试将其更改为 C:/Users/tongxuebin/Desktop/doc/ 但 Eclipse 说这是一个无效的 URL.

I tried to change it to C:/Users/tongxuebin/Desktop/doc/ but Eclipse said it was a Invalid URL.

那么如何解决这个问题呢?或者,我可以简单地将注释保存在 Ant 生成的 Jar 中吗?

So how to solve this problem? Or,can I simply save the comments in the Jar when it generated by Ant?

推荐答案

好像不能把javadoc和class文件放在同一个jar里,这样eclipse会自动显示doc.

It seems, that you can't put the javadoc in the same jar as the class files, so that eclipse will automatically show the doc.

一个解决方案是包含源代码.如果您需要调试该 jar 中的类,这也将有所帮助.

A solution is to include the source-code. This will also help, if you need to debug the classes in that jar.

这个答案:如何构建我的 jar 文件,以便使用该库的用户能够在 Eclipse 中看到 javadoc 涵盖了这种情况.但归结为:

This answer: How can I build my jar file so that users who use the library will be able to see the javadoc in Eclipse covers that case. But it just boils down to:

<target name="jar.noCompile.src">  
    <jar destfile="${ant.project.name}.jar">  
      <fileset dir="${classes}"/>  
      <fileset dir="${src}" includes="**/*.java"/>  
    </jar>  
</target>  

这篇关于我可以在我的 Jar 文件(由 Ant 生成)中保存评论信息吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆