How can I attach rotary encoder?

I am now trying to attach a rotary encoder to a stepper motor.
However, as shown in the picture, there is no device that can be screwed into the motor.
Is it possible to put something like double-sided tape or glue?

Thanks in advance.

If you want to use a rotary encoder, you must use a dual shaft stepper motor.
like this.

Hello, in my farmbot I have stepper motors like those of a 3D printer, I am not going to use encoder, my question is, how could I make it work using only the limit switches?

I hope the developer will answer, but it seems a bit busy recently. If you are using a limit switch without Rotary Encoder, you can remove the jumper switch shown below and connect the limit switch.