According to the exact analytical Bethe-ansatz solution of the one-dimensional spin-1/2 XXZ model, we perform a numerical study of one-dimensional spinless fermions in an optical lattice in the presence of harmonic potential by using a local density approximation. We study the density profile, and obtain the *ρ*-*u* phase diagram (here *ρ*=*N*_{f}√*V*_{2}/*t* is the characteristic dimensionless density and *u*=*V*/*t* is the interaction strength scaled in units of the hopping parameter t). With the increases of particle density and nearest-neighbour interaction, the system undergoes five different quantum phases. Through calculating the thermodynamic stiffness *S _{ρ}*, we find that it can be used as an order parameter. Its singular points can measure the quantum phase transitions in such a confined system.