"release" command from sbt-release plugin is not recognized - sbt

I can't get the sbt-release plugin to work at all. The "sbt release" command is not recognized.
As per plugin's documentation, I have this entry added to my ./project/plugins.sbt file in my play application:
addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.5")
And I'm running the latest to-date 0.13.6 version of sbt launcher. Here's the error that I get when I execute "sbt release" from my project directory:
[info] Loading project definition from /Users/Projects/project
[info] Loading [pom.xml]
[info] Use auto-generated Build object
[success] POM definition loaded
[info] Set current project to integration (in build file:/Users/Projects/project/)
[error] Not a valid command: release (similar: reload, eclipse, last)
[error] Not a valid project ID: release
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: release (similar: rpmRelease, rpm-release, resolvers)
[error] release
[error] ^
And just to make sure, that sbt-release plugin does get loaded into the project, I execute "sbt about", and it does show that sbt-release is in the list of Available Plugins. But again, for some reason, "sbt release" command is not recognized.
> sbt about
...
[info] Available Plugins: ... sbtrelease.ReleasePlugin, ...

As per sbt-release plugin documentation, added this line into my build.sbt file, and it did it! "sbt release" command is now being recognized.
releaseSettings
For some reason, it did not work for me the first time I tried it earlier. Something must have been going on in my environment or earlier version of my build.sbt file.

Related

sbt runmain does not find class

I have a function that I'm running with sbt runMain. I was able to get this working previously, but some changes in the project means it's no longer working, but I can't quite understand it.
When I run
sbt "runMain com.example.projects.data.CallMe" I get:
[error] (Compile / runMain) java.lang.NoSuchMethodException:
com.example.projects.data.CallMe.main([Ljava.lang.String;)
But in the SBT console, this works:
import com.example.projects.data.*
CallMe.main(List())
This succeeds. How would I be able to debug this?
Versions:
Scala 3.1.2
Sbt: 1.6.2

sbteclipse: create build.sbt and plugins.sbt

I have downloaded sbt and to resolve the proxy maven repository errors, I have created repositories files with my-maven-proxy-releases: under ~/.sbt
When I do a sbt about, I get the below details:
"~\.sbt\preloaded\org.scala-sbt\sbt\"1.0.4"\jars\sbt.jar"
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[warn] No sbt.version set in project/build.properties, base directory: C:\
[info] Set current project to root (in build file:/C:/)
[info] This is sbt 1.0.4
[info] The current project is {file:/C:/}root 0.1-SNAPSHOT
[info] The current project is built against Scala 2.12.4
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.4
Now, I wanted to import a project in eclipse and I googled. This is the details I found.
1. ~/.sbt/<sbt-version>/plugins/plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
sbteclipse
2. ~/.sbt/<sbt-version>/plugins/build.sbt
for scala versions and dependencies.
But I am confused on where to create the build.sbt and plugins.sbt as my folder structure is like this:
~/.sbt/1.0
~/.sbt/1.3
and I do not see ~/.sbt/1.0.4 which is displayed in sbt about.
Please guide if my understanding wrong.
First, you need to understand sbt project structure and the difference between project-local and global plugins.
As you would usually use eclipse plugin globally you should put it in
~/.sbt/<sbt-version>/plugins/plugins.sbt
(as you wrote correctly), where <sbt-version> is
0.13 for any sbt 0.13.*
1.0 for any sbt 1.*.* (this may seem unintuitive, but it's okay)
I guess, ~/.sbt/1.3 is just a typo and is meant to be ~/.sbt/0.13.
Also you normally don't put anything in ~/.sbt/<sbt-version>/plugins/build.sbt. If you need to have some global settings (including those for the global plugins), you should put them in
~/.sbt/<sbt-version>/global.sbt
Read about global settings here.
With non-global plugins and settings it's all the same minus the ~/.sbt/<sbt-version>/ part:
use <your-project>/plugins/plugins.sbt for plugins
and <your-project>/build.sbt for project settings

Why does sbt fail with NoClassDefFoundError: play/Play$ in Play 2.2.x projects after sbt compile in Play 2.3 project?

Once I run 'sbt compile' on a 2.3 play project, I can't use 'sbt compile' to compile any Play 2.2.x projects anymore. This is the error when I run sbt command.
[info] Loading project definition from /Users/macbookpro/playproject/project
[error] java.lang.NoClassDefFoundError: play/Play$
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
I just had this same issue. In my case I was using Play 2.4, but it's probably the same cause. I had run activator ui in my project directory accidentally. It created a project/play-fork-run.sbt file which is for activator support, but was preventing sbt from working directly. Deleting that file cleared up the issue and I can now use sbt again.
Try updating play-fork-run.sbt
addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.3.8")
update to
addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.4.0")
Then project will be able to build.
That's interesting issue since it works for me (TM) on Mac OS X 10.9.3 with Java 7.
I downloaded the versions of Play - the latest 2.3.1 and the latest in 2.2.x stream - 2.2.3. With these two versions I've used activator (2.3.1) to create the web application and play for 2.2.3. Both worked well.
When I executed sbt compile in 2.3.1 and then 2.2.3, both commands worked fine, too. It took me some time to have all the dependencies downloaded, but at the end the results were as follows:
jacek:~/sandbox/play231-app
$ sbt compile
[info] Loading project definition from /Users/jacek/sandbox/play231-app/project
[info] Updating {file:/Users/jacek/sandbox/play231-app/project/}play231-app-build...
...
[info] Done updating.
[info] Compiling 5 Scala sources and 1 Java source to /Users/jacek/sandbox/play231-app/target/scala-2.11/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.11.1. Compiling...
[info] Compilation completed in 14.895 s
[success] Total time: 200 s, completed Jun 25, 2014 1:00:18 PM
And for 2.2.3:
jacek:~/sandbox/play223-app
$ sbt compile
[info] Loading project definition from /Users/jacek/sandbox/play223-app/project
[info] Set current project to play223-app (in build file:/Users/jacek/sandbox/play223-app/)
[info] Updating {file:/Users/jacek/sandbox/play223-app/}play223-app...
...
[info] Done updating.
[info] Compiling 5 Scala sources and 1 Java source to /Users/jacek/sandbox/play223-app/target/scala-2.10/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.10.3. Compiling...
[info] Compilation completed in 19.626 s
[success] Total time: 45 s, completed Jun 25, 2014 3:15:34 PM
I'm using sbt 0.13.5 installed using homebrew.
$ sbt --version
sbt launcher version 0.13.5
$ java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
Play 2.3 app is supposed to be built using activator, to ensure proper sbt configuration. Best
I had the same issue. Make sure that you are using the java-8 version.
I was using java-7, changing to java-8 fixed my problem.

Plugin to create project tar file and publish it to Nexus in sbt?

Is there some kind of sbt plugin that enables publishing result to repository (i.e nexus).
I heard about sbt-native-packager but I need to create tarball (*.tar) and publish it to repository. I prepeare my own task that depends on dist and it repackages result from zip to tar. Next I just try to modify it with description available here: https://groups.google.com/forum/#!topic/play-framework/Td389FbdgCY. Unfortunately I get:
[error] java.lang.AssertionError: assertion failed: Internal task engine error: nothing running. This usually indicates a cycle in tasks.
[error] Calling tasks (internal task engine state):
[error] Task((taskDefinitionKey: ScopedKey(Scope(Select(ProjectRef(file:/C:/src/cms/,cms)),Global,Global,Global),projectDependencyArtifacts))) -> Calling
What is more additionaly to publishing package in repository I need to automatically create create tag for release in mercurial.

SBT 0.10.0/0.10.11 -- Potentially incompatible versions specified

I'm getting an error when running SBT, which I don't know where it originates from:
[info] Set current project to root (in build file:/home/dcs/.sbt/plugins/)
[warn] Potentially incompatible versions specified:
[warn] org.scala-tools.sbt: 0.10.1, 0.10.0
The JAR file for the sbt laucher is version's 0.10.1. The error happens even outside projects, such as when running screpl.
How do I fix it?
Do you have a build.sbt in /home/dcs/.sbt/build.properties that sets a particular sbt.version?
If not, you may have a global plugin installed that requires 0.10.0 as mentioned at https://groups.google.com/forum/#!topic/simple-build-tool/YoXd0Tp_cjo/discussion. The solution there was to wipe the global .sbt directory (your /home/dcs/.sbt).

Resources