I think the reason for the unreactivity is because melamine, although an amine, is electron-deficient because the aromatic ring is highly acidic. But before you give up, on a small scale, run the reaction in the absence of solvent. If that doesn't work, consider reacting 4-nitronitrophthalimide (which can be derived from your 4-nitrophthalic anhydride) with cyanuric chloride, then follow up by substituting the two remaining chlorides. Good luck!