我在使用IntelliJ IDEA 11。
当我将Global Library添加到模块并且工件IDE从不复制源和javadoc时。这是有道理的,因为它们在运行时不需要。但我在编译时需要它们。
有趣的是,如果我将依赖项作为文件夹添加,IDEA 使得源可用。我猜在这种情况下,它不会区分该文件夹中的内容。奇怪。
想法?
解决方案
具有我定义的源的那个:
分类:源 范围:提供 $ bEX:
< dependency> < groupId> org.hibernate< / groupId> < artifactId> hibernate-validator< / artifactId> < version> 4.1.0.Final< / version> <排除项> <排除> < groupId> javax.xml.bind< / groupId> < artifactId> jaxb-api< / artifactId> < /排除> <排除> < groupId> com.sun.xml.bind< / groupId> < artifactId> jaxb-impl< / artifactId> < /排除> < /排除> < /依赖关系> < dependency> < groupId> org.hibernate< / groupId> < artifactId> hibernate-validator< / artifactId> < version> 4.1.0.Final< / version> < classifier> sources< / classifier> < scope>提供< / scope> < /依赖关系>
How can I make sources of dependent libraries to be available in classpath on compilation ?
I'm using IntelliJ IDEA 11.
When I add Global Library to module and artifact IDE never copies sources and javadocs. That makes sense because they are not needed in runtime. But I need them in compile time.
Interestingly though IDEA makes sources available if I add dependency as folder. I guess in this case it doesn't differentiate what sits in that folder. Odd.
Thoughts ?
解决方案i solved this issue in maven config by specifying another dependency to hibernate-validator one with sources and one without.
the one with sources i defined:
classifier: sources scope: provided
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>
更多推荐
IntelliJ IDEA:如何使依赖库的源在编译的类路径中可用?
发布评论