How to provide dependencies to javadoc?


(Alex Sko) #1

my Vaadin-based project can’t be compiled with Vaadin 7.0.6 or 7.0.7. I think the Gradle Vaadin plugin I’m using has changed (the current one shown in the output is 0.7) and it’s a new failure…

anyway, the project can be build OK with “gradle build -x javadoc” but it fails when I run “gradle build”

what’s the right way to provide dependencies to Javadoc task only (I can’t add extra stuff to the compilation & packaging itself)?

:webshared:javadoc
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/VaadinReq
uest.java):29: error: package javax.portlet does not exist
import javax.portlet.ClientDataRequest;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/VaadinReq
uest.java):30: error: package javax.portlet does not exist
import javax.portlet.PortletRequest;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/VaadinRes
ponse.java):24: error: package javax.portlet does not exist
import javax.portlet.MimeResponse;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/VaadinRes
ponse.java):25: error: package javax.portlet does not exist
import javax.portlet.PortletResponse;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/VaadinRes
ponse.java):26: error: package javax.portlet does not exist
import javax.portlet.ResourceResponse;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/VaadinSes
sion.java):32: error: package javax.portlet does not exist
import javax.portlet.PortletSession;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/WrappedSe
ssion.java):22: error: package javax.portlet does not exist
import javax.portlet.PortletSession;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/VaadinSer
vice.java):31: error: package javax.portlet does not exist
import javax.portlet.PortletContext;
                    ^
C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaadin/server/AbstractC
ommunicationManager.java):63: error: cannot access JavaScript
import com.vaadin.annotations.JavaScript;
                             ^
  bad source file: C:\Users\ask\.gradle\caches\modules-2\files-2.1\com.vaadin\vaadin-server.0.6b2de5b6de8044e5bd9eb97c80b0cd5aca6c01a\vaadin-server-7.0.6.jar(com/vaad
in/annotations/JavaScript.java)
    file does not contain class com.vaadin.annotations.JavaScript
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
9 errors
:webshared:javadoc FAILED

here’s my webshared/build.gradle file:

import org.apache.tools.ant.filters.*
  dependencies {
    compile libraries.httpclient
    compile libraries.slf4j
    compile libraries.slf4jJdk
      compile "com.vaadin:vaadin-client-compiled:$vaadinVersion"
    compile "com.vaadin:vaadin-client:$vaadinVersion"
    compile "com.vaadin:vaadin-themes:$vaadinVersion"
      compile libraries.servletAPI
      compile project(":common")
    compile project(":mainapp")
    compile 'com.project123:license:1'
      testCompile project(":test-utilities")
  }
  afterEvaluate {
    configure(allProcessResourcesTasks()) {
        filter(ReplaceTokens,
                tokens: [project123Version: PROJECT_123_VERSION])
    }
}
  def allProcessResourcesTasks() {
    sourceSets*.processResourcesTaskName.collect {
        tasks[it]
    }
}

UPDATE: everything works fine if I switch from using the “latest” plugin (currently 0.7) to the previous version:

‘’‘apply from: ‘http://plugins.jasoft.fi/vaadin.plugin?version=0.6.5’’’’

instead of

‘’‘apply from: ‘http://plugins.jasoft.fi/vaadin.plugin’’’’

so it looks like a problem with the plugin itself…


(Peter Niederwieser) #2

See ‘Javadoc’ in the Gradle Build Language Reference (specifically the ‘classpath’ property).


(Alex Sko) #3

thank you. I fixed the Portlet issue by adding javax.portlet to Javadoc’s classpath dependency.

the second issue (JavaScript class not found) is still there. it look that the Vaadin jar file has TWO (!) JavaScript classes in the same package and it (probably) breaks Gradle class resolution.


(Peter Niederwieser) #4

Gradle doesn’t do any class resolution. Looks like javac isn’t happy with it.