简体   繁体   English

将Eclipse文档添加到Eclipse Project,导出jar

[英]Adding Java docs to Eclipse Project whlie exporting jar

So I have a Java Project in Eclipse for which I can generate a Jar file. 所以我在Eclipse中有一个Java项目,我可以生成一个Jar文件。 Now I can use this jar file in other projects. 现在我可以在其他项目中使用这个jar文件。 However when I add this jar file to other project's build path using eg Eclipse, it does not show any documentation. 但是,当我使用Eclipse将此jar文件添加到其他项目的构建路径时,它不会显示任何文档。

It only works, if while generating Jar file, I also separately generate java docs, and on the user side, when I import this jar, I have to separately specify the java docs for this jar. 它只能工作,如果在生成Jar文件时,我也单独生成java文档,而在用户端,当我导入这个jar时,我必须单独指定这个jar的java文档。

I just want to know, is there any way that I can export java docs and the project altogether as a single jar, so that when imported in other projects using Eclipse IDE it shows the documentation without having to import the java docs explicitly? 我只想知道,有没有什么方法可以将java文档和项目完全导出为单个jar,这样当使用Eclipse IDE导入其他项目时,它显示文档而无需显式导入java文档?

如果在导出jar文件时选择“导出源文件和资源”选项,则应该能够在其他项目中查看文档。

@manish approach and don't work for me. @manish方法,不适合我。 In my case the solution was different. 在我的情况下,解决方案是不同的。 You also try do it in four simple steps: 您还可以通过四个简单的步骤尝试:

  1. Right click project - Export - Jar File 右键单击项目 - 导出 - Jar文件
  2. Right click project - Export - JavaDoc 右键单击项目 - 导出 - JavaDoc
  3. Compress JavaDoc folder with 7Zip or similar one. 使用7Zip或类似的压缩JavaDoc文件夹。 Rename with 'jar' extension. 用'jar'扩展名重命名。
  4. Create folder with both and compress it. 用两者创建文件夹并压缩它。 Rename with 'jar' extension as well. 也可以使用'jar'扩展名重命名。

Example

/your-library-v1.0.0.jar
  - your-library.jar 
  - your-library-doc.jar

Now you can Import the library (your-library-v1.0.0.jar) and Javadoc will be vailable in your projects. 现在您可以导入库(your-library-v1.0.0.jar),Javadoc将在您的项目中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM