繁体   English   中英

IntelliJ IDEA:如何使依赖库的源在编译时的类路径中可用?

[英]IntelliJ IDEA: How can I make sources of dependent libraries to be available in classpath on compilation?

如何使依赖库的源在编译时的classpath中可用?

我正在使用IntelliJ IDEA 11。

将全局库添加到模块和工件时,IDE永远不会复制源代码和javadocs。 这是有道理的,因为在运行时不需要它们。 但是我在编译时需要它们。

有趣的是,如果我将依赖项添加为文件夹,则IDEA 可使源可用。 我猜在这种情况下,它不能区分该文件夹中的内容。 奇。

有什么想法吗?

我通过指定对hibernate-validator的另一个依赖关系(带有源和不带有hibernate-validator)解决了maven配置中的此问题。

我定义的来源之一:

分类器: 来源范围: 提供

EX:

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.1.0.Final</version>
        <exclusions>
            <exclusion>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.1.0.Final</version>
        <classifier>sources</classifier>
        <scope>provided</scope>
    </dependency>

GWT编译中未使用附加到库的源是一个错误。 此错误已在IDEA 11.1 EAP中修复。

暂无
暂无

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

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