I have been on a relatively small project team (2-3 members) and found it difficult to sustain project momentum. The initial momentum was easily created when everyone is enthusiastic and excited about the new project. However, once the initial phase is over, the momentum is difficult to sustain. I have found this to be the case for projects with a long delivery time (4-5years).
A few ideas how to keep momentum in long-term projects:
Frequent releases. Try to release often. You can introduce time-boxing, e.g. Scrum sprints, to create a sense of urgency within the team.
Measuring performance. Measures like velocity in Scrum or cycle time in Kanban shows basically how fast the team is running. If you measure it over time you can make a point in keeping the pace or even improving it over time.
Continuous improvement. Don't make it about project and project only. In one of my previous teams where we were working on a long-term project we focused on improving the way we worked which was a) motivating and b) helped us to keep momentum.
Try new things. In long-term projects there are usually a lot of space to try new things out. Think where you can give people freedom to decide on technology, practices and methods they adopt. Make it great learning experience and not just building yet another project.
Bring fresh blood. Adding some fresh blood usually helps to restore enthusiasm and often brings new ideas. This can affect people attitude pretty much. In such a small team it can be difficult be even short spell of some fresh faces can help much.
Move people out of their comfort zones. Usually people end up doing tasks they're familiar with. One would focus on database the next one will deal with business logic and another will cover GUI (or however the work is split). Encourage people to work on areas they aren't that familiar with. Maybe it's not about optimizing productivity but would bring some challenges to people, thus motivate them.
Yeah, 4-5 year delivery time would be very hard to maintain momentum. Are there any milestones in that time frame? The first thing I can think to suggest is to set some more frequent milestones that can be reached and "celebrated". Ideally these would be things that you could fully complete such that everyone can say "okay, that part is done and we don't have to worry about it anymore".
Positive reinforcement increases desired behavior. People gravitate towards reward and recognition. People go where they are paid to go. These are truisms on which you can bank. If you are having issues with maintaining project enthusiasm, it makes me ask about the project's inherent value. Project excitement and enthusiasm trickle down from the top. If you are seeing a drop in enthusiasm from your team, then I would bet you are seeing the same drop in the sponsor, customers, and stakeholders. The questions become: has the perceived value of your project dropped? Have other project priorities replaced yours? If those answers are yes, then whatever you do at the project level would have little to no impact.
Commitment is hard to maintain for long term projects. We have a tendency to be myopic with severe attention deficit disorder. If you are not or cannot show interim value for your project as you are progressing, then you run the risk of people losing interest, which will flow down to you and your team.
Periodically revisit the original business case and go through the exercise of validating and refreshing it. In doing so, you could re-energize leadership and get them focused on your project and that will have the sequelae effects on your team. You may also learn that the business case no longer justifies project spend causing the project to be terminated. This is not a bad thing.
Now, if your enthusiasm drop is really related to morale, that is a different discussion completely.
People who work on projects tend to like change and long timeline projects get to be a grind. You have some great answers above. I'll throw in a couple of ideas from another perspective. This type of issue is common in sales teams, they have an annual goal, but need to be motivated throughout the year. This is done by;
breaking down the year end goal into shorter term pieces so achievement can be recognized frequently. celebrating milestones along the way- often there's a celebration at the end of specific campaigns. Realizing that the long term goal is met through a series of short term steps.