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 Hibernate Basics Persisting Data with Hibernate Fetching Data with Hibernate

Getting compiler warning

Why am I getting the following warnings and how should I fix it? It seems to be referring to the build.gradle sourceCompatibility. Should I change it?

Warning:java: source value 1.5 is obsolete and will be removed in a future release Warning:java: target value 1.5 is obsolete and will be removed in a future release Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.

1 Answer

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

The problem comes for a number of reasons...

But I think it is because of this sourceCompatibility line in build.gradle, you are right.

Short answer, set it to 1.8.

For a long answers, see for example here

https://teamtreehouse.com/community/issues-with-gradle-jdk-version-and-language-level

Why It didn't come when Chris did the video

The reason why Chris didn't have that error, comes from the fact that he used older versions of Intellijdea, and there IDE was NOT creating 'Separate Modules Per Set':

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

Right now you are using new Intellijdea, and by default the checkbox 'Create separate modules per set' is checked. (see screenshot above).

That is why this sourceCompatibilty = 1.5 throws this warning at you.

Solution 1

Just change sourceCompatiility = 1.5 to 1.8 OR remove the line completely

Solution 2

Close intellijdea, delete .idea folder and re-import Gradle project once again with 'Create separate modules per set' unchecked.

https://teamtreehouse.com/community/fyi-you-might-need-to-uncheck-create-separate-module-per-source-set