如何将附加的javadoc或来源在libs文件夹罐子? [英] How to attach javadoc or sources to jars in libs folder?

查看:178
本文介绍了如何将附加的javadoc或来源在libs文件夹罐子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的ADT R17的Eclipse插件版本新增功能自动安装JAR依赖。在/ libs文件夹中所有.jar文件添加到构建的配置了。不幸的是Android的依赖关系的类路径容器是不可修改的。

New version of ADT r17 plugin for Eclipse added feature to automatically setup JAR dependencies. Any .jar files in the /libs folder are added to the build configuration now. Unfortunately Android Dependencies classpath container is non modifiable.

我怎么能连接Javadoc和源代码的自动插入的.jar(从/ libs文件夹)?

How can i attach javadoc and sources to the automatically inserted .jar (from /libs folder)?

推荐答案

要回答你的问题的最好办法是从总结的泽维尔 plastiv ,的VinceFR 和<一href="http://stackoverflow.com/questions/9873152/how-to-attach-javadoc-or-sources-to-jars-in-libs-folder#comment18650782_11579339">Christopher.

The best way to answer your question is to summarize the answers from Xavier, plastiv, VinceFR and Christopher.

为了到来源和javadoc 链接到的.jar库由Eclipse的自动连接,你必须做到以下几点:

In order to link the sources and javadoc to a .jar library that is automatically linked by Eclipse you have to do the following:

  1. 将库.jar文件中的的文件夹,以及相关的源.jar和文档在不同的子文件夹中的.jar文件如的库/ src目录库/文档的。您可以使用一个名称以外的的src 文档的,如果你想要的,但它是非常重要的.jar文件不能直接在的文件夹中。
  2. 的文件夹中的实际库的.jar的确切名称创建一个的.properties 文件(见例子)。请确保您保留的的.jar 的一部分。
  3. 指定在的.properties 文件的来源和javadoc的.jar的相对路径。
  4. 关闭,然后重新打开Eclipse项目!或者,刷新该项目由pressing <大骨节病> F5
  5. 选择在源$ C ​​$ C链接库的对象。
  6. 打开Eclipse中的Javadoc视图来查看文档(见截图)。
  7. 打开源$ C ​​$ C的声明。(默认快捷键:<大骨节病> F3 )所选对象的
  1. Place the library .jar file in the libs folder, and the associated source .jar and doc .jar files in separate subfolders such as libs/src and libs/docs. You can use a name other than src and docs if you want, but it's important that the .jar files aren't directly in the libs folder.
  2. Create a .properties file in the libs folder with the exact name of the actual library .jar (see example). Make sure you keep the .jar part.
  3. Specify the relative paths to the sources and javadoc .jar in the .properties file.
  4. Close and re-open the Eclipse project! Optionally, refresh the project by pressing F5.
  5. Select an object of the linked library in the source code.
  6. Open the Javadoc view in Eclipse to check the documentation (see screenshot).
  7. Open the source code declaration (default shortcut: F3) of the selected object.


该示例使用 GSON库

libs
├── docs
│   └── gson-2.2.2-javadoc.jar
├── gson-2.2.2.jar
├── gson-2.2.2.jar.properties
└── src
    └── gson-2.2.2-sources.jar

内容gson-2.2.2.jar.properties的

src=src/gson-2.2.2-sources.jar
doc=docs/gson-2.2.2-javadoc.jar



您当然可以将Javadoc和源代码的.jar到其他文件夹,并指定相对路径。这取决于你。直接放置在源和javadoc罐子到的的lib 的文件夹是可能的,但不建议,因为这会导致文档和源$ C ​​$ C是包含在您的应用程序

You can of course move the javadoc and sources .jar into other folders and specify relative paths. That's up to you. Placing the source and javadoc jars directly into the lib folder is possible but not recommended, as that causes documentation and source code to be included in your application.


在Eclipse的JavaDoc面板的屏幕截图:


Screenshot of the Eclipse JavaDoc panel:

使用GSON了Android 4.2.2的Eclipse项目的截图:

Screenshot of an Eclipse project using Gson with Android 4.2.2.:

如果你要引用它们不提供作为一个包装的.jar ,而只是作为文件和文件夹作为问<一的javadoc href="http://stackoverflow.com/questions/9873152/how-to-attach-javadoc-or-sources-to-jars-in-libs-folder/11579339?noredirect=1#comment29221147_11579339">android开发商在评论做到以下几点:

In case you want to reference javadocs which are not provided as a packed .jar but simply as files and folders as asked by android developer in the comments do the following:

  1. 将库的.jar 库/ 文件夹
  2. 创建一个的.properties ,其内容如下文件:

  1. Place the library .jar in the libs/ folder
  2. Create a .properties file with the following content:

 doc=docs

  • 添加的javadoc文件夹复制到库/ 文件夹。

  • Add the javadocs folders to the libs/ folder.

    您应该拿出下列文件夹结构:

    You should come up with the following folder structure:

    ├── docs
    │   ├── allclasses-frame.html
    │   ├── allclasses-noframe.html
    │   ├── com
    │   │   └── google
    │   │       └── ads
    │   │           ├── Ad.html
    │   │           │   ....
    │   │           └── package-tree.html
    │   │   ...
    │   └── stylesheet.css
    ├── GoogleAdMobAdsSdk-6.4.1.jar
    └── GoogleAdMobAdsSdk-6.4.1.jar.properties
    

    不要忘记为关闭并重新打开 Eclipse项目如上所述! 这是一个工作示例项目引用 GoogleAdMobAds的Andr​​oid库的截图。

    Do not forget to close and re-open the Eclipse project as mentioned above! Here is a screenshot of a working example project referencing the GoogleAdMobAds Android library.

    这篇关于如何将附加的javadoc或来源在libs文件夹罐子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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