通过CLI设置maven-surefire-plugin的系统属性

时间:2016-08-10 19:25:35

标签: maven testing maven-surefire-plugin

我目前正在研究一个用例,我必须通过命令行为maven-surefire-plugin设置系统属性。我试图使用 case class Car(model: String, age: Int, partIds: Seq[String]) object ListToMap extends App { val car1 = Car("corolla", 1, Seq("b")) val car2 = Car("camry", 5, Seq("b", "c")) val car3 = Car("fit", 6, Seq("e")) val car4 = Car("prelude", 2, Seq("e", "f")) val car5 = Car("cobalt", 10, Seq("j")) val cars = List(car1, car2, car3, car4, car5) //For Every Car lets make the list of Tuples for PartId -> Car def partMapping(car : Car) : Seq[(String, Car)] = car.partIds.map(part => part -> car) def toPartMap(cars : List[Car]) : Map[String, List[Car]] = cars //Get the List of Tuples PartId -> Car and then flatten the internal list (same as map().flatten) .flatMap(partMapping) // group all the tuples by the partId .groupBy(_._1) // We currently have a Map[String, List[(partId -> Car)]] we need to clean that up a bit to remove the partId .mapValues( carMapping => carMapping.map(_._2)) toPartMap(cars).foreach(println) } 属性,但似乎我的构建没有获取文件中的属性。这是我尝试过的语法:

systemPropertiesFile

我正在使用Maven 3.0.5。通过POM文件设置相同的属性工作正常,但不幸的是,这不是我可以使用的解决方案。我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

systemPropertiesFile未公开为用户属性,因此如果您不想更改pom.xml,可以使用argLine

mvn install -DargLine="-DmyProperty=abc -DotherPoperty=def"