2013-08-29 77 views
2

我想添加本地javadoc jar到maven dependency。可能吗?如果是,我该怎么办?问题是,我有其中包含传递罐子Gradle - 如何为maven依赖项指定javadoc位置jar文件?

dependencies { 
    compile 'org.eclipse.persistence:eclipselink:2.5.0' 
} 

gradle dependencies命令返回此Maven的依赖性:

compile - Compile classpath for source set 'main'. 
+--- org.eclipse.persistence:eclipselink:2.5.0 
    +--- org.eclipse.persistence:javax.persistence:2.1.0 
    \--- org.eclipse.persistence:commonj.sdo:2.1.1 

主要依赖eclipselink包含的javadoc javax.persistence,所以我不能看到的Eclipse Javadoc提示编辑。我想要做的是连接eclipselink javadoc到javax.persistence

这是我所期望的:

dependencies { 
    compile 'org.eclipse.persistence:javax.persistence:2.1.0' { 
     javadoc = <path to javadoc> 
    } 
} 

回答

2

问题解决了。我编辑了使用gradle eclipse插件的eclipse .classpath文件,它做它应该做的。这是代码:

eclipse { 
    classpath { 
     downloadSources=true 
     downloadJavadoc=true 
     file { 
      withXml { 
       def node = it.asNode() 
       // find eclipselink javadoc path 
       def eclipselinkPath = configurations.compile.find { it.absolutePath.contains('eclipselink') } 
       def javaxPersistenceJavadocPath = "" 
       node.each { 
        def filePath = it.attribute('path') 
        if (file(filePath) == file(eclipselinkPath)) { 
         javaxPersistenceJavadocPath = [email protected][0] 
        } 
       } 
       // add eclipselink javadoc path as attribute to javax.persistence 
       def javaxPersistencePath = configurations.compile.find { it.absolutePath.contains('javax.persistence') } 
       node.each { 
        def filePath = it.attribute('path') 
        if (file(filePath) == file(javaxPersistencePath)) { 
         it.appendNode('attributes').appendNode('attribute', [name:'javadoc_location', value:javaxPersistenceJavadocPath]) 
        } 
       } 
      } 
     } 
    } 
} 

我知道这看起来很难看,但我没有更多的时间与问题进行战斗。顺便说一句,它不是我的问题的根源(我有依赖关系或gradle缓存的问题,我还不知道)。

相关问题