Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javadoc not shown when using a local Maven repo

I have published an artifact with build.gradle below:

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "file://maven")
            pom.groupId = 'com.totvnow'
            pom.artifactId = 'tonedetect-lib'
            pom.version = '0.1.0'
        }
    }
}

task androidJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
    classifier = 'javadoc'
    from androidJavadocs.destinationDir
}

artifacts {
    archives androidJavadocsJar
}

And I successfully get javadoc files files in repo directory:

tonedetect-lib-0.1.0-javadoc.jar
tonedetect-lib-0.1.0-javadoc.jar.md5
tonedetect-lib-0.1.0-javadoc.jar.sha1

But when I use it in another module's build.gradle:

buildscript {
    repositories {
        jcenter()
        maven { url 'somepath\\maven' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'somepath\\maven' }
    }
}

and

dependencies {
    compile 'com.totvnow:tonedetect-lib:0.1.0'
}

The Javadoc does not pop up when I use Ctrl-Q on a class in the library. Java codes are fine, and when I click on the class Android Studio gives me the decompiled code without any problem. Also, other dependencies such as support library v4 shows Javadoc correctly.

Does anyone know possible reasons?

like image 711
Romulus Urakagi Ts'ai Avatar asked Jun 11 '15 06:06

Romulus Urakagi Ts'ai


People also ask

How do I fix Javadoc errors?

You need to call mvn javadoc:fix to fix main Java source files (i.e. inside src/main/java directory) or mvn javadoc:test-fix to fix test Java source files (i.e. inside src/test/java directory).

What is maven classifier?

A Maven artifact classifier is an optional and arbitrary string that gets appended to the generated artifact's name just after its version number. It distinguishes the artifacts built from the same POM but differing in content.


1 Answers

I have no Android Studio experience. However after searching on the internet for a bit I found to following things:

  1. This seems to be a know issue. I found some very similar issues and questions: 1, 2, 3, 4, etc.
  2. These things may potentially help to get it working:

    • Applying the idea plugin and configuring it to download the JavaDoc:

      apply plugin: 'idea'
      idea {
          module {
              downloadJavadoc = true
              downloadSources = true
          }
      }
      
    • In Android Studio go to: File -> Other Settings -> Default Settings... -> Maven -> Importing and check the boxes to download the sources and documentation.
    • Use this plugin to overcome the issue that Android Studio does not know how to locate the Gradle sources and javadoc location(?)
like image 90
HELOX Avatar answered Oct 13 '22 17:10

HELOX