First consider the case in which $(R, \mathfrak m)$ is local. IfIf we assume that $R/\mathfrak m$$\text{Spec}(R)$ is projectiveconnected, then it is a summand of $R$ is always a field (by consideringnote the natural surjection $R\rightarrow R/\mathfrak m$spectrum of a local ring is always connected). Now $R = I\oplus R/\mathfrak m$ for some (necessarily finitely generated) ideal $I$ and $I$ This is such that $I = \mathfrak m I$equivalent to the nonexistence of nontrivial idempotents. By Nakayamma's lemma, $I = 0$ and $R$ Indeed, hence $R = R/\mathfrak m$ and $R$ isover a field.
In the general casecommutative ring any, simple $R$-module is also of the form $R/\mathfrak m$ for a maximal ideal $\mathfrak m$ of $R$. Write $R = R/\mathfrak m \oplus I$, for some finitely generated ideal $I$ of $R$. By the determinant trick, there is an $x\in R$ with $x-1\in I$ such that $xI = I$, hence $I = I^2$ and. This implies $I$ is generated by an idempotent, since I can be taken to be finitely generated. .
Note if we assume thathence $\text{Spec}(R)$ is connected$I = 0$, thensince $R$$R/\mathfrak m$ is always a fieldnonzero.