Warren Hehir, 19, of Assumpta Park, St Mary’s Park, pleaded guilty a year ago to his part in the assault which was carried out when he was aged 16.
Sentencing was adjourned to see how he behaved and to await a probation report.
Det Garda Sean Lynch told the court that Hehir had been in trouble three times since the case was adjourned, resulting in 19 separate convictions for multiple offences.
Judge Carroll Moran said the victim, Barry Ahern, could have been killed from the stab wounds.
The court heard Hehir and two others, already dealt with by the court, admitted attacking Mr Ahern but none admitted causing the eight stab wounds to his upper back which punctured his lung.
Hehir, the court heard, had paid €5,000 in compensation to the victim.
State prosecutor John O’Sullivan BL, said on the night of the assault, Mr Ahern was walking home when he was set upon by Hehir and two others. They were on their way to a 24-hour shop after drinking in a house.
The attack came to the notice of Gardaí following two calls to the emergency services.
Gardaí traced one of the calls to the phone of one of the accused and he admitted phoning the emergency services.
All three admitted their part in the attack and stealing €30, a passport and a mobile phone from the victim.
But none admitted to inflicting the stab wounds.
Judge Moran said he had put back the case for a year to see if Hehir would stay out of trouble, but he had not.
He jailed Hehir for four years and suspended the final two years.