If you adopt the same ideology as another AI that will almost guarantee you a lifelong friend. So Poland adopted Autocracy, join him and he should remain friendly, ignoring your attack on Brazil. From what I've seen, as long as you are friendly with another AI, they will disregard your war...