简体   繁体   English

在Maven中:如何将源附加到tools.jar

[英]In Maven: how to attach sources to tools.jar

I have to use libraries in tools.jar and have therefor added this dependency: 我必须在tools.jar中使用库,并为此添加了这个依赖项:

<dependency>
    <groupId>com.sun</groupId>
    <artifactId>tools</artifactId>
    <version>1.6.0</version>
    <scope>system</scope>
    <systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>

Now I would like to attach the sources in Eclipse, so I see what I develop against. 现在我想在Eclipse中附加源代码,所以我看到了我开发的内容。 I guess nothing will be available in the standard maven repositories (I can't even find anything in download.java.net/com/sun ). 我想标准的maven存储库中什么都没有(我甚至无法在download.java.net/com/sun中找到任何内容 )。

I know there is a source archive available , but it contains everything and I would at least need to know what parts of it need to go in the source jar. 我知道有一个源存档可用 ,但它包含所有内容,我至少需要知道它需要在源jar中的哪些部分。

Has someone done this? 有人这样做过吗? Is there a tools-sources.jar available somewhere? 在某处可以使用tools-sources.jar吗? Or can you tell me what parts of the jdk sources I need? 或者你能告诉我我需要哪些jdk资源?

Here's what I did. 这就是我做的。 I downloaded the source archive from openjdk , extracted it and manually linked the jar source to 从openjdk下载了源存档 ,将其解压缩并手动将jar源链接到

External Folder -> [unpacked archive basedir]/langtools/src/share/classes

This is not a maven solution, it's eclipse only, but it works. 这不是一个maven解决方案,只是eclipse,但它有效。

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

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