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.


Todd Baker
Todd Baker
17,207 Points

How To Run Gradle Task

The video on how to run a Gradle task isn't running. Is there a way to make the quick video on how to run this Gradle task available? I'm having trouble figuring out how to run the java program downloaded for this exercise.

Todd Baker
Todd Baker
17,207 Points

I was able to see the video run as a giph, but now I get this error when I run the task in IntelliJ:

Execution failed for task ':test'.

There were failing tests. See the report at: file:///Users/toddbaker/Downloads/lcc-java-fp-printer-1.1.0/build/reports/tests/test/index.html

Any thoughts on how I can fix this?

I guess because you have opened the file from Downloads file instead IdeaProject.

You have to unzip the file and paste it in: User -> toddbaker -> IdeaProjects User Then start the IntelliJ program and choose Import Project then choose the catalog printer ( btw they have a double map I dunno why)

After that, you get the error of red text and suggesting to update - click on that go to file gradlew and check to accept their suggestion also, file gradlew bat

then go to main.class and click the green "play" button to run...

Todd Baker
Todd Baker
17,207 Points

Thanks Oshedhe! That helped a lot and I was able to run it.


4 Answers

Hey Oshedhe, I figured it out, thank you for your help..I appreciated it.. :)

Hey I have tried unzipping file under user -> Peter -> IdeaProject and it is still giving me an error message:

public static void printChipmunksDeclaratively(List<String> chipmunks) { // TODO: Print out each of the chipmunks using the forEach method on Iterable chipmunks.forEach(chipmunk -> System.out.println(chipmunk!)); ^ } }

C:\Users\Peter\Downloads\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunk!)); ^ Im not sure what to do at this point?...any help would be appreciated. Thank you

Are you sure that you have unzipped the file to Ideaproject? because it replied here: C:\Users\Peter\Downloads\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24

it looks like you have opened the file from downloads..

hey I tried your method and was able to unzip it to IdeaProject, but it told me i had to update the gradle wrapper, then it still gave me the same error...

C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunk!));

} } sorry for the hassle..I just don't understand why it keeps telling me that there is an error?

Hey!! I think maybe know the answer I think you have coded correctly but missing one little thing!! :) Please check this link: https://teamtreehouse.com/community/local-code-challengeusing-foreach

hello, I have unzipped to IdeaProject, I dont have an import option when i select file, only an export also, i tried importing setting and clicked on the ideaProject and It still gave me the same error, also I have tried using the method reference instead and also it says I have 3 tests completed and 1 failed, I also tried uninstalling intellij Idea and reinstalling it, still the same issue...

I also took a look at the link you gave me and it still giving me an error, do i have to do anything else besides using the lambda, like for example when it says to create a field named "chipmunk" on intellij Idea?

At this point im not sure why its telling me that there is an error, I have tried alot of options to try to get it to work, But im stumped, if there is a way to complete this task please let me know.. Thank you

Task :test

com.teamtreehouse.challenges.PrinterTest > printsProperly FAILED java.lang.AssertionError: The output from your method 'printChipmunksDeclaratively' seems wrong Expected: a string containing "Example1!" but: was "Example1 Example2 Example3 " at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:865) at com.teamtreehouse.teachingassistant.rules.Consoler.assertExpected(Consoler.java:61) at com.teamtreehouse.challenges.PrinterTest.printsProperly(PrinterTest.java:59)

3 tests completed, 1 failed

Task :test FAILED

Execution failed for task ':test'.

There were failing tests. See the report at: file:///C:/Users/Peter/IdeaProjects/lcc-java-fp-printer-1.1.0/build/reports/tests/test/index.html

C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ';' expected chipmunks.forEach(chipmunk) -> System.out.println(chipmunk!)); ^

C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunks!));

C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunk!));

chipmunks.forEach(chipmunk -> System.out.println(chipmunk!));

You have coded almost correct in for each but it's a bit wrong! Look at this page: https://teamtreehouse.com/community/local-code-challengeusing-foreach

It should be System.out.println(chipmunk + "!"); try and let me know what the compiler saying.. :s