Skip to content
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

enablePlugins can not find plugin if it is added in subproject #4414

Open
1 task done
jobtijhuis opened this issue Oct 8, 2018 · 1 comment
Open
1 task done

enablePlugins can not find plugin if it is added in subproject #4414

jobtijhuis opened this issue Oct 8, 2018 · 1 comment
Labels
Enhancement uncategorized Used for Waffle integration

Comments

@jobtijhuis
Copy link

If you have a project with a subproject in it the enablePlugins(FooPlugin) cannot find the plugin if it is added in the meta-build of the subproject, while I think this should be the case because sbt is recusive.

Reproduction steps

Create a sbt project with a subproject with the following structure:

project/
  plugins.sbt (empty)
site/
  project/
    plugins.sbt
  build.sbt (sub)
build.sbt (root)

build.sbt (root):

name := "projectwithplugins"

lazy val root = project.in(file(".")).aggregate(site)

lazy val site = project.in(file("site"))

build.sbt (sub) the Play Framework is used as an example of an plugin that needs to be enabled explicitly:

name := "test-site"

enablePlugins(PlayJava)

site/project/plugins.sbt:

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.16")

If you run sbt on this configuration it will fail with the error:

/home/job/Development/test-enablePlugins/site/build.sbt:3: error: not found: value PlayJava
enablePlugins(PlayJava)

If you then copy the site/project/plugins.sbt to project/plugins.sbt it works, but this is not what is expected.

Problem

enablePlugins can not find plugins added by the meta-build in site/project/plugins.sbt

Expectation

Sbt is recusive and the meta-build builds the definitions for the subprojects build. The meta-build is executed as seen by downloading of packages, but the plugins are then not found by enablePlugins, while you would expect the plugins to be loaded and could be found by enablePlugins.

Notes

sbt version: 1.2.3

@eed3si9n
Copy link
Member

eed3si9n commented Oct 9, 2018

Currently sbt recurses into project/ directory, but not the subprojects to discover metabuild.
I don't know if we should keep drilling into directories after directories to achieve this.

What might be interesting would be to come up with a notation where part of the *.sbt is read ahead of time as if it is project/plugin.sbt:

lazy val app = (project in file("."))

@metabuild lazy val plugins = Seq(
  addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.16")
)

@eed3si9n eed3si9n added the uncategorized Used for Waffle integration label Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement uncategorized Used for Waffle integration
Projects
None yet
Development

No branches or pull requests

2 participants