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

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

问题描述



但是当我在新项目中使用这个JAR时,我可以不要在Eclipse中看到Jar的评论(按F2)。



所以我试图在我的新的属性的javadoc位置中添加javadoc文件的位置路径项目,它不起作用,即使Eclipse告诉我位置可能有效。



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



我尝试将其更改为但是Eclipse表示这是一个无效的URL。



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

解决方案

看来,你不能将javadoc放在与文件相同的jar中,这样eclipse就会自动显示文档。



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



此答案:如何构建我的jar文件,以便用户谁使用库将能够看到Eclipse中的javadoc 涵盖了这种情况。但是它只是归结为:

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


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

But when I use this Jar in a new Project, I can't see the Jar's comment in the Eclipse(pressing F2).

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'.

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,.

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

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

解决方案

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.

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

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天全站免登陆