Why is Eclipse not attaching 3rd party libs source files to a WTP-faceted Gradle project?

匿名 (未验证) 提交于 2019-12-03 00:59:01

问题:

The sources are downloaded in the Gradle cache and the classpath-entries for the source files looks ok, but Eclipse does not show the source files for 3rd party libs.

                                                                                                                                                                                                          

回答1:

That's a weird behavior in Eclipse with the generated .classpath-file. Just put the 'Web App Libraries' entry at the bottom of your classpath file (-> Java Build Path -> Order and Export).

The best solution is to enhance your gradle.build file (then you don't need to reorder your build path each time you generate the classpath file via gradle):

... eclipse.classpath.file {     // Classpath entry for Eclipse which changes the order of classpathentries; otherwise no sources for 3rd party jars are shown     withXml { xml ->         def node = xml.asNode()         node.remove( node.find { it.@path == 'org.eclipse.jst.j2ee.internal.web.container' } )         node.appendNode( 'classpathentry', [ kind: 'con', path: 'org.eclipse.jst.j2ee.internal.web.container', exported: 'true'])     } }


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!