Reputation: 6516
I want to add local javadoc jar to maven dependency. Is it possible? If yes, how can I do it? The problem is that I've got maven dependency which contains transitive jars
dependencies {
compile 'org.eclipse.persistence:eclipselink:2.5.0'
}
gradle dependencies
command returned this:
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
Main dependency eclipselink
contains javadoc for javax.persistence
so I can't see javadoc hints in eclipse editor. What I want to do is to connect eclipselink
javadoc to javax.persistence
.
This is what I expect:
dependencies {
compile 'org.eclipse.persistence:javax.persistence:2.1.0' {
javadoc = <path to javadoc>
}
}
Upvotes: 3
Views: 1871
Reputation: 6516
Problem solved. I've edited eclipse .classpath
file using gradle eclipse
plugin and it do what it should. This is the code:
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 = it.attributes.attribute.@value[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])
}
}
}
}
}
}
I know that it looks ugly but I didn't have more time to fight with that problem. BTW it wasn't the source of my problem (I've got problem with dependencies or gradle cache, I don't know yet).
Upvotes: 2