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

unable to "sbt run", No main class detected #76

Open
alanngai opened this issue Jan 18, 2014 · 9 comments
Open

unable to "sbt run", No main class detected #76

alanngai opened this issue Jan 18, 2014 · 9 comments

Comments

@alanngai
Copy link

I'm trying to use scalabuf to generate scala code from protofiles, but I'm having trouble getting it to even run. I'm using scala 2.10.3, sbt 0.13.1, and java 1.7.0_21

after checking out the repo,

$ sbt run
Loading /Users/alan/dev/sbt-0.13.1/bin/sbt-launch-lib.bash
[info] Loading project definition from /Users/alan/work/cloudmon/dev-master/ProtoServer/tools/protobuf-src-gen/src/github.com/SandroGrzicic/ScalaBuff/project
[info] Set current project to scalabuff (in build file:/Users/alan/work/cloudmon/dev-master/ProtoServer/tools/protobuf-src-gen/src/github.com/SandroGrzicic/ScalaBuff/)
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last scalabuff/compile:run for the full output.
error No main class detected.
[error] Total time: 0 s, completed Jan 17, 2014 5:15:12 PM

so I ran sbt again to enter the console and ran the following to get the stack trace

run
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last scalabuff/compile:run for the full output.
error No main class detected.
[error] Total time: 0 s, completed Jan 17, 2014 5:17:10 PM
last scalabuff/compile:run
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$36$$anonfun$apply$37$$anonfun$26.apply(Defaults.scala:655)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$36$$anonfun$apply$37$$anonfun$26.apply(Defaults.scala:655)
at scala.Option.getOrElse(Option.scala:120)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$36$$anonfun$apply$37.apply(Defaults.scala:655)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$36$$anonfun$apply$37.apply(Defaults.scala:654)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
error No main class detected.

@alanngai
Copy link
Author

figured out the command should be

sbt 'project scalabuff-compiler' 'run --proto_path=.. --scala_out=...'

would be nice to see this in the documentation

@SandroGrzicic
Copy link
Owner

Actually, by default you should be in the scalabuff-compiler project
already. I'm guessing this is due to some change in sbt that I need to fix
(probably add a default project). Please reopen the ticket, I need to fix
the problem. Thanks for the report!

Also you can try using sbt-scalabuff (linked to from the readme) for easier
generation in your existing sbt project.
On 18 Jan 2014 03:00, "Alan Ngai" [email protected] wrote:

Closed #76 #76.


Reply to this email directly or view it on GitHubhttps://github.com//issues/76
.

@alanngai
Copy link
Author

re-opening as requested

@alanngai alanngai reopened this Jan 18, 2014
@prayagupa
Copy link

@SandroGrzicic I'm facing the same issue while compiling .proto files with following command,

> run --proto_path=src/main/resources/ --scala_out=src/main/scala/code/model/

from sbt-project$ ./sbt.

References

Usage examples

@lupiv
Copy link

lupiv commented Apr 1, 2014

Me too - with an old version (1.2.0) though - and when I use the command above :
sbt 'project scalabuff-compiler' 'run --proto_path=.. --scala_out=...'

I runs, confirms a successful run, but does not generate any scala classes

Vipuls-MacBook-Pro-3:ScalaBuff-1.2.0 vipul$ sbt 'project scalabuff-compiler' 'run --proto_path=/path/to/proto/ --scala_out=/path/to/scala'
[info] Loading project definition from /Users/.../ScalaBuff/1.2.0/ScalaBuff-1.2.0/project
[info] Set current project to scalabuff-1-2-0 (in build file:/Users/.../ScalaBuff/1.2.0/ScalaBuff-1.2.0/)
[info] Set current project to scalabuff-compiler (in build file:/Users/.../ScalaBuff/1.2.0/ScalaBuff-1.2.0/)
[warn] Credentials file /Users/vipul/.ivy2/.credentials does not exist
[warn] Credentials file /Users/vipul/.ivy2/.credentials does not exist
[info] Running net.sandrogrzicic.scalabuff.compiler.ScalaBuff --proto_path=/path/to/proto/ --scala_out=/path/to/scala
[success] Total time: 0 s, completed Apr 1, 2014 2:34:24 PM

but /path/to/scala has nothing in it

~Vipul

@lupiv
Copy link

lupiv commented Apr 1, 2014

btw same thing runs with 1.2.2

@SandroGrzicic
Copy link
Owner

Have you tried the latest version (1.3.7)?

@lupiv
Copy link

lupiv commented Apr 1, 2014

Oh yes, It works like a charm with 1.3.7 - the only problem is that I"m using this with Spark which comes packaged with Protobuf 2.4.1 and using 1.3.7 creates conflicts. I had no choice but to go back in time and get 1.2.*

@SandroGrzicic
Copy link
Owner

Sorry to hear that. Have you been able to resolve this? I'm hoping a newer release of Spark has a newer Protobuf.

andreaTP added a commit to andreaTP/ScalaBuff that referenced this issue Apr 17, 2015
SandroGrzicic added a commit that referenced this issue Sep 8, 2015
Fix: unable to 'sbt run', No main class detected #76
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

4 participants