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

"javac returned nonzero exit code" error with no stacktrace or details in SBT 0.13.8+ #2256

Closed
JoshRosen opened this issue Oct 27, 2015 · 10 comments
Assignees
Labels

Comments

@JoshRosen
Copy link

Consider the following invalid javacOptions config:

scalacOptions ++= Seq("-target:jvm-1.6"),
javacOptions ++= Seq("-source", "1.7", "-target", "1.6"),

With SBT 0.13.7, this results in the following error message:

[error] javac: source release 1.7 requires target release 1.7
[error] (compile:compile) javac returned nonzero exit code

In SBT 0.13.8+, on the other hand, the error details are missing, making this hard to debug:

[error] (compile:compileIncremental) javac returned nonzero exit code

I think that SBT's handling of javac error output must have changed in 0.13.8 because there are reports from other users that describe similar symptoms:

@JoshRosen JoshRosen changed the title "javac returned nonzero exit code" error with no stacktrace o details in SBT 0.13.8+ "javac returned nonzero exit code" error with no stacktrace or details in SBT 0.13.8+ Oct 27, 2015
@dwijnand
Copy link
Member

Yes, things changed in 0.13.8 with #1702

@eed3si9n eed3si9n added the Bug label Oct 28, 2015
Duhemm added a commit to Duhemm/sbt that referenced this issue Nov 4, 2015
Upon startup, javac may report errors because (for instance) because it
received incorrect flags. These errors were not correctly parsed by the
JavaErrorParser and were never reported to the user.

This commit fixes this problem by adding a new parsing rule in
JavaErrorParser: errors that start with the prefix "javac:" are now
correctly parsed and reported to the user.

Fixes sbt#2256
Duhemm added a commit to Duhemm/sbt that referenced this issue Nov 11, 2015
Upon startup, javac may report errors because (for instance) because it
received incorrect flags. These errors were not correctly parsed by the
JavaErrorParser and were never reported to the user.

This commit fixes this problem by adding a new parsing rule in
JavaErrorParser: errors that start with the prefix "javac:" are now
correctly parsed and reported to the user.

Fixes sbt#2256
@shajra
Copy link

shajra commented Jan 3, 2016

Just curious, do you know when this is going to hit an SBT release? Is there a workaround? We've got at least one module that for now needs to be pure-Java, and this problem is kind of annoying. It feels weird pinning us to 0.13.7 just for this (though I'm not sure if we're really using any features in 0.13.8+ beyond bug fixes)

@eed3si9n
Copy link
Member

eed3si9n commented Jan 3, 2016

@shajra Hopefully soon. You can try the nightly from here in the meantime - https://dl.bintray.com/sbt/ivy-snapshots/org.scala-sbt/sbt-launch/0.13.10-20151229-205306/

@shajra-cs
Copy link

@eed3si9n good to know. Using a nightly is probably more awkward than just downgrading temporarily to 0.13.7, but at least now I know where the nightlies are. Also, I have this thread of conversation to point coworkers to if they are curious about the state of things. Thanks.

@shajra-cs
Copy link

@eed3si9n actually, I shouldn't assume. What's the best way to use that URL for the SBT 0.13.10 snapshot? We're using Paul's "sbt-extras" script.

@eed3si9n
Copy link
Member

eed3si9n commented Jan 3, 2016

I personally don't use the script, so I'm not sure if it works with the nightlies (it might you can try it first). My recommendation would be to try manual installation - http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html

@dwijnand
Copy link
Member

dwijnand commented Jan 3, 2016

@shajra-cogscale

Use -sbt-launch-repo https://repo.scala-sbt.org/scalasbt/ivy-snapshots.

Or you can use my branch: https://github.com/dwijnand/sbt-extras/tree/sbt-launch-snapshot-repo (diff)

@shajra-cs
Copy link

@dwijnand thanks, that's what I ended up doing. Also, I put in the snapshots repository in our proxy. I think that gets us through this until 0.13.10 properly releases.

@shajra-cs
Copy link

Okay, I played around with the snapshot release of 0.13.10, and I think it helps, but maybe doesn't solve the problem completely.

We're on Java 8, and turned on -Xlint:all to start with (which seems to have some non-standard reporting syntax), and here's some output shown for 0.13.7 that's still being suppressed with the 0.13.10 snapshot:

[error] warning: No processor claimed any of these annotations: com.fasterxml.jackson.annotation.JsonProperty,com.netflix.governator.annotations.Configuration,javax.ws.rs.ext.Provider,com.google.inject.Inject,javax.annotation.PreDestroy,lombok.extern.slf4j.Slf4j,com.google.inject.Provides,lombok.Data,javax.annotation.PostConstruct,com.fasterxml.jackson.annotation.JsonCreator,javax.annotation.Nullable,com.google.inject.Singleton
[error] error: warnings found and -Werror specified
[error] 1 error
[error] 1 warning
[error] (insights-web/compile:compile) javac returned nonzero exit code
[error] Total time: 26 s, completed Jan 3, 2016 2:49:52 PM

I think the fix doesn't catch this because it's not prefixed with "javac:", but I need to look at the patch and code more closely.

It kind of sucks that we're matching on strings. Perhaps we need to include "warning:" and "error:" in the match too?

@shajra-cs
Copy link

Just a note, this particular warning is suppressed with -Xlint:all,-processing. I think I really need to make a minimal project that fails for each of the checks in javac's -Xlint, so we can see that we've captured everything with any fix.

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

No branches or pull requests

6 participants