Predicting student performance is crucial for both preventing failure and enabling personalized teaching-and-learning strategies. The digitalization of educational institutions has led to the collection of extensive student learning data over the years. Current research primarily focuses on short-term data, e.g. a single year or semester. In contrast, long-term data has the potential to offer a deeper insight into student behavior, thereby increasing the accuracy of predictions. However, the direct application of long-term data in prediction models assumes consistent data distributions over time. In the real world, evolutions in course content and structure can lead to variations in feature spaces (heterogeneity) and distribution shifts across different academic years, compromising the effectiveness of prediction models. To address these challenges, we introduce the Learning Ability Self-Adaptive Algorithm (LASA), which can adapt to the evolving feature spaces and distributions encountered in long-term data. LASA comprises two primary components: Learning Ability Modeling (LAM) and Long-term Distribution Alignment (LTDA). LAM assumes that students' responses to exercises are samples from distributions that are parameterized by their learning abilities. It then estimates these parameters from the heterogeneous student exercise response data, thereby creating a new homogeneous feature space to counteract the heterogeneity present in long-term data. Subsequently, LTDA employs multiple asymmetric transformations to align distributions of these new features across different years, thus mitigating the impact of distribution shifts on the model's performance. With these steps, LASA can generate well-aligned features with meaningful semantics. Furthermore, we propose an interpretable prediction framework including three components, i.e. LASA, a base classifier for outcome predictions, and Shapley Additive Explanations (SHAP) for elucidating the impact of specific features on student performance. Our exploration of long-term student data covers an eight-year period (2016-2023) from a face-to-face course at Tsinghua University. Comprehensive experiments demonstrate that leveraging long-term data significantly enhances prediction accuracy compared to short-term data, with LASA achieving up to a 7.9% increase. Moreover, when employing long-term data, LASA outperforms state-of-the-art models, ProbSAP and SFERNN, by an average accuracy improvement of 6.8% and 6.4%, respectively. We also present interpretable insights for pedagogical interventions based on a quantitative analysis of feature impacts on student performance. To the best of our knowledge, this study is the first to investigate student performance prediction in long-term data scenarios, addressing a significant gap in the literature. [ABSTRACT FROM AUTHOR]