Maine allows for a deduction of up to $10,000 per year on pension income. However, that deduction is reduced in an amount equal to your annual Social Security benefit. So, for example, if you receive $12,000 in Social Security benefits this year, you cannot claim the deduction on your other forms of retirement income. In that case, all your other retirement income will be taxed as part of your gross income.
In the Maine interview, proceed to the screen entitled "Retirement Income and Contributions" and indicate that you had pension income
The next screen is "Pension Income Deduction" (see screenshot for the screen from a test return). Enter your military or non-military pension as indicated.