Failure: Could not determine which tasks to execute


(Erich Schroeter) #1

I am getting the following error:

$ gradle ProjectRoot:artifactoryPublish
Cannot publish pom for project ':' since it does not contain the Maven plugin install task and task ':artifactoryPublish' does not specify a custom pom path.
  FAILURE: Could not determine which tasks to execute.
  * What went wrong:
Project 'ProjectRoot' not found in root project ':ProjectRoot'.
  * Try:
Run gradle tasks to get a list of available tasks.
  BUILD FAILED

I have a project structure where I have multiple sub projects in the modules directory. These sub projects are fully independent gradle projects. The root project exists in order to package each of the artifacts generated by the sub projects.

  ProjectRoot/



build.gradle



modules/





 ProjectSubA/







  build.gradle





 ProjectSubB/







  build.gradle





 ProjectSubC/







  build.gradle  

All projects (root and sub projects) apply the Maven and Artifactory plugins. The issue I’m encountering is that when I execute the artifactoryPublish task, all projects’ are tasks are executed, but I only want the root project’s task to be executed. How do I specify that?


(Peter Niederwieser) #2

‘gradle :artifactoryPublish’


(Erich Schroeter) #3

That command is executing the ‘artifactoryPublish’ task on all the sub projects as well. How do I avoid that?


(Peter Niederwieser) #4

If ‘gradle :artifactoryPublish’ (notice the ‘:’) also executes the subproject tasks, it means that it depends on them and isn’t meant to be executed alone. In that case I suggest to contact the authors of the Artifactory plugin to discuss your requirements with them.

Of course you can do ‘rootProject.artifactoryPublish.dependsOn = []’, but that seems like a hack and might lead to new problems.


(Erich Schroeter) #5

Ahah, so that helps. I do have the sub projects as dependencies in the root project. The reason is because the root project’s only artifact is to package up the subprojects’ artifacts into an installer. So, it sounds like I need to remove the subprojects as dependencies, and then manually download the artifacts from a repo. Does that sound right?

Finding it hard to figure out how to manually download artifacts from a repo. How would one manually download an artifact in Gradle?


(Luke Daley) #6

Do you need to download them from the repo? Or could you just use the local files?


(Erich Schroeter) #7

Preferably from the repo, because that way I know they are the officially published artifacts. Unless you’re talking about the locally downloaded artifacts in the gradle cache, which that would have the same effect (I think).


(Peter Niederwieser) #8

I do have the sub projects as dependencies in the root project.

This does not explain why the root project’s ‘artifactoryPublish’ task depends on the subprojects’ ‘artifactoryPublish’ task. My guess is that the ‘artifactoryPublish’ task is simply meant to publish everything at once.