You can certainly change how you respond to things and learn to stand up for yourself.
The classic "nice guys" and "jerks" are responding in different ways to the same stimuli. The first is suing for peace in lieu of conflict while the second is redirecting his discomfort instead of expressing it honestly and directly.
People above mention setting your personal boundaries. This is paramount. To thine own self be true as the Bard wrote. The problem is many people are fearful of social excommunication. Being dumped, ridiculed, yelled at, etc. That's why it feels so incongruent to do it.
If you have to choose between disappointing others and disappointing yourself, always choose them. It is their problem.
Now the tricky part is being firm without losing your cool. However, if you KNOW you are being 100% honest with what you want, this should get easier. When men dance around this, they get angry - at themselves, then others.
None of this means you can't compromise, by the way. Again that's all a matter of being true to what you want and what you'll sacrifice.
All of this dovetails with the old Sosuave rule of being willing to walk away. Don't be afraid to lose something that isn't right for you.