Jenkins plugin - Supertypes of the following classes cannot be resolved


#1

Hi Everyone,

I’m trying to develop a Jenkins plugin using kotlin.

The entry point of a Jenkins plugin is a class which extends Recorder, when I add such class to my project I cannot compile it anymore. Here’s an example:

public class LastChangesPublisher : Recorder(), SimpleBuildStep {

    override fun getRequiredMonitorService(): BuildStepMonitor? {
        throw UnsupportedOperationException()
    }

    override fun perform(run: Run<*, *>, workspace: FilePath, launcher: Launcher, listener: TaskListener) {
        throw UnsupportedOperationException()
    }

}

the error I got is this:

[ERROR] Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
    class hudson.model.AbstractProject, unresolved supertypes: ParameterizedJob
    class hudson.model.BuildableItem, unresolved supertypes: Task
    class hudson.model.AbstractBuild, unresolved supertypes: Executable
    class hudson.model.Project, unresolved supertypes: ProjectWithMaven   

Although unresolved classes are on my classpath.

The log for mvn package command can be found here: http://pastebin.com/Vu9b31Yz

I’ve attached a sample project here last-changes-plugin.zip (186.6 KB)

Any help is appreciated.


#2

It seems to be Kotlin couldn’t read the class because of huge generics complexity of outer class ParameterizedJobMixIn. Compiler bug


#3

See simplified example @Stanislav.Erokhin (still requires a lot of dependencies to be downloaded, patience)

last-changes-plugin.zip (131,1 КБ)


#4

Hi @sergey.mashkov,

Should we open an issue for this or its a known limitation?

Thank you so far.


#5

Yes, please, open a ticket for this.


#6

issue created: https://youtrack.jetbrains.com/issue/KT-12664

Thank you for looking at this, let me know if you need more details or any help.