Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,161 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


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':


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.