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

Command not defined #1

Closed
pr1001 opened this issue Nov 24, 2011 · 3 comments
Closed

Command not defined #1

pr1001 opened this issue Nov 24, 2011 · 3 comments

Comments

@pr1001
Copy link

pr1001 commented Nov 24, 2011

I installed the plugin as specified in the README:

addSbtPlugin("me.lessis" % "np" % "0.2.0")

resolvers += "lessis" at "http://repo.lessis.me"

I then created a new folder, cd'ed into it, ran sbt, and then attempted to run np:

> np
[error] Not a valid command: np (similar: <, -, inspect)
[error] Not a valid project ID: np
[error] Not a valid configuration: np
[error] Not a valid key: np (similar: run, name, skip)
[error] np
[error]   ^

Did I do something wrong? This is using sbt 0.11.1.

@softprops
Copy link
Owner

add the following to your build def

seq(npSettings:_*)

np used to just override settings can get the auto setting mix treatment but there is an issue with that in sbt if you are using global plugins do the the order in which build definitions get evaluated. What I mainly wanted was a way to set a default name and org id for all my projects. I set those at a global level but found that you have a chicken and egg situation if you want to provide a default in the plugin (which I do) and and global override. In my case, the default overrides the global settings because of the order sbt loads settings.

Try explicitly mixing in npSettings and get back to me. I'll leave the issue open until then. In the meantime, I'll update the readme.

For reference, this is what I use locally in a ~/.sbt/np.sbt config

seq(npSettings:_*)

(NpKeys.defaults in (Compile, NpKeys.np)) ~= {
  _.copy(org="me.lessis", version="0.1.0-SNAPSHOT")
}

@pr1001
Copy link
Author

pr1001 commented Nov 28, 2011

Ahhh, I see. Creating a ~/.sbt/peter.sbt file with that line worked.

It'd be nice to be able to use the plugin out of the box without 'importing' the settings, since most sbt plugins don't require that, but your reasons not to do that make sense.

@pr1001 pr1001 closed this as completed Nov 28, 2011
@softprops
Copy link
Owner

Yes, for defining plugin tasks its almost always a bad idea to override settings. In this of np, due to the load ordering of sbt, you custom overrides may also potentially be ignored in favor of the defaults if I overrode def settings. Being able to globally set an org of me.lessis for all generated projects was very useful to me, so I wanted to enforce being explicit over implicit as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants