Inter methods aren't supported when extending Jar

I have this task

@CacheableTask
class WebjarTask extends Jar {

  public static final String WEBJAR_RESOURCES_FOLDER = "META-INF/resources"
  JsExtension ext

  @InputDirectory
  def jsDistDir

  WebjarTask() {

    WebjarTask() {
      ext = project.getExtensions().findByType(JsExtension)

      this.jsDistDir = ext.jsDistDir
    }

    /**
     * Basically, we’re making a jar file and putting all the resources
     * into the META-INF/resources directory.
     * @return
     */
    @TaskAction
    def webjarMethod() {
      into WEBJAR_RESOURCES_FOLDER
      from(jsDistDir)
    }
  }
}

problem is im getting a compiler error “inter methods aren’t supported” on the method “webjarMethod”. This exact model works when i extend a Copy, why doesn’t it work when i extend Jar?

nevermind (again), got some coffee, came back and saw the type-o. Thats an hour of my life ill never get back.

Just FYI, it can be dangerous to use @CacheableTask on Copy-like tasks (which includes Jar) because not all of the task’s inputs are properly tracked.

E.g., any changes to filter {}, expand {}, rename {}, eachFile {} are ignored and don’t factor into the build cache key.

It can also mask issues with missing inputs in other tasks (that feed into the cacheable task).

The other odd thing about your WebjarTask is that JsExtension ext is going to shadow the ExtraProperties properties named ext on that task, which might be surprising for someone using the task.