Failure: Could not determine which tasks to execute

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.

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.










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?

‘gradle :artifactoryPublish’

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

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.

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?

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

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

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.