Adiabatic soliton trapping is observed due to the frequency-dependent gain in fiber amplifiers. The soliton pulse width is practically unaffected by the nonresonance of the carrier frequency, while the soliton self-frequency shift (SSFS) becomes very sensitive to this nonresonance. It is shown that the effective component of the gain spectrum for the SSFS compensation is the linearly frequency dependent gain with a positive slope, and an optimal compensation condition is identified. The stability of the steady-state solution for the perturbed nonlinear Schrodinger equation is also studied using the phase-plane formalism.