New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Cannot run tasks for included builds" #511
Comments
This is a limitation of Gradle itself, as you can't directly address tasks from the included builds. |
This is not a composite build. It is a straightforward multi-project build. Are you telling me that the new version of Gradle will take a multi-project build and assume it is composite without any change to the build. Is there any way to turn this "feature" off? |
Nope, the tasks should be disabled only for the included builds. I'll have a look how could you end up in this phase. Could you create a sample project exhibiting the problem so that we can use it for the investigation? |
This usually happens when a user runs Our detection could instead use the Also, we should really finally add proper root project detection, so we use that as the connectionProjectDir, even when the user selects a subproject when adding the nature. @sc1478 sorry for the techno-babble, these were just some implementation hints for @donat |
Also, your reply that "this is a limitation of gradle itself" seems to ignore my initial statement
Do you still need a sample from me? I'm not clear at this point. |
Is something needed from me to make progress on this issue? It's still an issue in Buildship-2.1.1 I am surprised this issue doesn't have higher visibility. |
I'm seeing the same issue, but it was working fine until I just upgraded from Gradle 3.5 to 4 |
Yes, it's not an issue when using 3.x gradle wrapper, only with 4. |
Actually, I have one multi-project with 4.0 that works and one that doesn't. Not obvious what's the difference between them... |
Ended up closing all the projects and deleting from eclipse, then "Import Existing Gradle project" and reopened the root project. Now they all show green again... |
Thanks for that tip. It does work. |
I still have this error as well. I've tried closing, deleting, and re-importing the projects (both by importing the root, and by importing the sub-projects first), but I still can't run tasks for the subprojects. There are green gear icons next to them (unlike the grey ones in the original screenshot here), but double-clicking them doesn't do anything, and right-clicking them gives the same "Cannot run tasks for included builds". These are standard multi-project builds. I can run the builds/tasks from the command line, and can create run configurations in eclipse to do the same as a work around for now. If I import the subproject first, I can run tasks for it up until I import a project that depends on it. |
@kcclaas any chance you can reproduce that with a small example on GitHub? |
Sure, I'll see if I can come up with something tonight. |
Thank you, I see what the problem is now - the message is wrong. It should read "Cannot run task selectors in non-standard project layouts". In a flat layout like yours, Gradle cannot find the root project when launched from a subproject. This is why we can't make "task selectors" (run this task here and in all subprojects) work. "Project tasks" (run this task only in this subproject) should work though. They are hidden by default, but you can show project tasks by checking the correspdoning option in the drop-down menu of the tasks view. |
I wish I could provide you a sample of the original project that caused me to open this issue, but the problem in that case went away upon reimporting it into Eclipse. I can tell you, though, that my project followed the conventional layout pattern in which subprojects were contained in subdirectories of the project root directory. |
@oehme Oh, cool. Thanks for explaining that, I didn't even realize that menu was there. Everything works for me as you said. |
The problem that @sc1478 faced is very likely caused by what I pointed out here: #511 (comment). So I'd keep this issue open until we have investigated whether this is the case. |
@totszwai You have a flat project layout, please activate the |
Ah crap it automatically greyed out all the tasks again. @oehme where exactly is |
Never mind, found it, wow... |
@donat I think we should reconsider what we display in the tasks view. Maybe we could get rid of the "show project tasks" option and instead show project tasks automatically if task selectors aren't available. And if task selectors are available we could add an option to the context menu like "run only in this project". That way users never have to switch an option based on their project layout, but always get the best possible support we can give. Long term we should fix Gradle to support task selectors in non-standard layouts. That would be great for composite builds as well. |
For those who had a similar problem in include builds - Check the file I my case this (non empty property) happens when turning back from included projects to non-included projects... @donat @oehme Not sure, whether this may help to solve the issue too. In facts, my issue comes from an out dated Version used: |
@kuniss You shouldn't need to manually edit the preference file. Just refreshing the root project should do the trick. Any chance you can reproducibly get back into the broken state? |
The question is, what is the root project? I do not have such thing like a parent project in Xtext created projects (I know it from)... |
The root project is the one where your settings.gradle file lives. |
I guess you may reproduce easily by checking out projects javapos-contracts, javapos-controls, javapos-config-loader from https://github.com/JavaPOSWorkingGroup. However, if you add
to your gradle.properties (which enables include nature of the projects, see project's |
.. I have a settings.gradle file on each of the projects as they can be checked out independently and in different sets. |
Okay there was a terminology issue: Those are included builds. So you are creating a composite and then trying to split it back apart and that is not working, did I get that right? |
Right, I switch between composite builds and not composite builds. I called it included builds as I created them using
Is included build not the right term for that? |
You said "included projects" earlier, which is why I thought you had this problem in a simple multi-project build. I think this gives us enough information to reproduce and find a fix, thanks Denis! |
I have a composite build always and the same problem with multiple included builds showing in "Gradle Task". All my projects live under the same workspace root in Eclipse and none of these projects use any subprojects and only one
It's 4 times I still don't understand one thing and would be grateful if you could explain the expected behaviour and what the actual problem is (one more time): I understand that one can not execute tasks of included builds in a composite build because of Gradle itself. I think this makes even sense to me. So in my example above with 4 times having What I don't understand is why I can't execute tasks on the 1 When I'm executing So what is the expected behaviour in such a setup? Should I be able to issue tasks for the 1 Thanks! |
There shouldn't be 4 times the same project in the tasks view. Please share a reproducible sample. |
Find my reduced examples at the bottom, it seems things depend on project-import-order in Eclipse a bit and it doesn't seem to make a difference if I delete the Eclipse-related files or not. What about the statement for composite builds? Should one be able to execute tasks of included builds on those included builds only or not? I would like to be able to sometimes build individual projects regardless of if they are used in a composite build or not and from my understanding that is exactly the use-case for composite builds. |
That's currently not possible, as Gradle provides Buildship no way to address those tasks. Note that there is a difference when you jump into the project directory on the command line - in that case you are just building that single build. But when you've imported a composite into Buildship, that included build is always treated as included. There is no way to treat it as standalone, except for removing it from the composite. |
Couldn't Buildship provide some GUI or context menu which would let me tell it to simply do what I would otherwise need to do on the shell manually? It even already knows all the available tasks and could put an entry into the already available context menu for the disabled tasks. It could even simply use the shell if it's not possible otherwise, users would still benefit because they wouldn't need to leave Eclipse manually. |
Another use-case for which it would be useful to be able to run individual task on included builds only and which as well only make sense for individual projects: I'm using gradle-eclipseconfig to manage project settings regarding the current charset etc. As one can see in the following screenshot, I'm unable to run the necessary tasks for the individual projects from the GUI only because it is included in some others: The funny thing is that the including project doesn't even provide these tasks in its view. |
|
@kuniss I'm now Version: 2019-12 (4.14.0) and your solution works fine. Without it this whole composite build is totally useless, because it's not possible to generate facets for included projects. |
In current versions of Eclipse and depending on the distribution chosen, this is easily possible without any additional support from Buildship or plugins by simply using This opens a new view with a shell in which Gradle can be executed as needed without leaving Eclipse, with the important point being that one doesn't need to navigate to the concrete project of interest manually anymore. If that terminal is not provided by default, it can be installed using the marketplace or some alternatives chosen. |
Heads-up: Gradle 6.8 will allow task execution in included builds. I'll adjust Buildship to support this feature. |
Gradle 6.8 and Buildship 3.1.5 is released. |
Buildship is telling me it can't do the included builds.
Yet, if I go to the command line in the same directory and run
./gradlew clean
, gradle has no trouble doing the job. I tried refreshing the Gradle project from the Eclipse menu, that did not helpGradle version 4.0
Buildship version Buildship: Eclipse Plug-ins for Gradle 2.0.1.v20170302-1039 org.eclipse.buildship.feature.group Eclipse Buildship
Eclipse tells me no updates are available.
The text was updated successfully, but these errors were encountered: