goomph icon indicating copy to clipboard operation
goomph copied to clipboard

equinoxLaunch: Task with name 'jar' not found in project ':foo'

Open restlessronin opened this issue 3 years ago • 4 comments

    id 'com.diffplug.osgi.equinoxlaunch' version '3.37.0'

This error is being produced at

https://github.com/diffplug/goomph/blob/f49fa797b535986812924e4b24d3ec417a281b5c/src/main/java/com/diffplug/gradle/eclipserunner/EquinoxLaunchSource.java#L68

It is being caused by

source.addProject(project(':foo.'))

within

equinoxSetup

I commented out the line and added

        project(':foo').getTasks().each {println it.name}

This produces no output, although the same line in the build file for ':foo' produces a list of tasks including the 'jar' task.

I'm on Gradle 7.4.2

This appears to be related to https://docs.gradle.org/current/userguide/task_configuration_avoidance.html

Seems like there needs to be some way to explicitly specify the dependency on the task (or it's output jar) in the build.gradle.

UPDATE: I do already have an implementation dependency on project('foo') in the same file. That doesn't seem to be enough.

I'm a gradle neophyte, so I'm probably missing some obvious solution.

restlessronin avatar Jun 25 '22 11:06 restlessronin

I think this is a problem of plugin ordering. You should apply the java plugin before the equinoxLaunch if you are doing addThisProject(). Might need to add some calls to evaluationDependsOn also, for projects where you are doing addProject(project('foo'))

nedtwigg avatar Jun 25 '22 17:06 nedtwigg

I added

evaluationDependsOn(':foo')

immediately after the plugins block, and it fixed that problem.

Seems hacky though.

restlessronin avatar Jun 26 '22 03:06 restlessronin

Seems hacky though.

Yes, almost certainly EquinoxLaunchSource ought to call evaluationDependsOn for you under the hood. Happy to take a PR for that if you'd like it fixed.

nedtwigg avatar Jun 26 '22 15:06 nedtwigg

Ok. Next time I get a chance to work on the project, I'll address this and the other issues.

restlessronin avatar Jun 26 '22 17:06 restlessronin

FYI, I would recommend looking at Solstice for a problem like this

https://github.com/equodev/equo-ide/tree/main/solstice

nedtwigg avatar Mar 01 '23 20:03 nedtwigg