diffplug / goomph

IDE as build artifact
Apache License 2.0
130 stars 30 forks source link

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

Closed restlessronin closed 1 year ago

restlessronin commented 2 years ago
    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.

nedtwigg commented 2 years ago

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'))

restlessronin commented 2 years ago

I added

evaluationDependsOn(':foo')

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

Seems hacky though.

nedtwigg commented 2 years ago

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.

restlessronin commented 2 years ago

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

nedtwigg commented 1 year ago

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

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