Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Michael Walters
Michael Walters
5,850 Points

I found a problem with the instructions in the Spark video 'Meet Spark'.

https://teamtreehouse.com/library/intro-to-java-web-development-with-spark/diving-into-web-development/meet-spark

I'm using IntelliJ Ultimate 2016.2. In this video, the IntelliJ screen when creating a new project has changed. There is a new box that is ticked by default: 'Create separate module per source set'. If you don't untick it, IntelliJ won't compile the Spark project and error, saying the version is wrong.

If you untick that box, everything works again.

3 Answers

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Well it should work both ways, I don't know how does unticking can break project.

If you leave option 'Create separate module per source set' ticked, nothing bad will happen.

Some people don't like it, for example here

http://stackoverflow.com/questions/36372571/intellij-idea-and-gradle-why-there-are-3-modules-per-sub-module

There you also can see the difference what will happen if you turn it on or off.

But it does not break project.

You are creating a new project. And this option just changes the way Intellijidea treats modules, it does not break anything.

Michael Walters
Michael Walters
5,850 Points

I don't know, man – I tick it, I get the error, I untick it, I don't get the error. It's repeatable. Someone else might run into the same problem, so I thought I'd better put it in here for reference, if nothing else.

Michael Walters
Michael Walters
5,850 Points

The error is: Error:java: javacTask: source release 1.8 requires target release 1.8

When you leave 'Create separate module per source set' checked, if you open Preferences > Build, Execution, Deployment > Compiler > Java Compiler, the version per module is set to 1.6 or lower. That causes the error.

But, if you don't check it, IntelliJ doesn't set versions per module, and the release error doesn't happen.

I definitely think it's useful to log this somewhere - it's a simple fix if you know where to look. Unless you can see something else I'm missing...?

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

You can also fix this error by replacing following line from Gradle:

sourceCompatibility = 1.5

With

sourceCompatibility = 1.8

Or you can simply delete sourceCompatibility line at all, will work just fine as well.

Refresh Gradle project and you'll be just fine.

Take a look at question here

https://teamtreehouse.com/community/wont-compile-i-got-this-instead-errorjava-javactask-source-release-18-requires-target-release-18

But your solution is interesting too!