In PlantUML, also like in Graphviz, the order of definitions is important.
So it's better to define the classes before the edges (links).
This should work fine:
@startuml
package Package1 {
class Class1 {
}
class Class2 {
}
class Class3 {
}
Class1 "1" *-- "many" Class3 : contains
}
Class1 "1" *-- "many" Class2 : contains
@enduml