# Passing Duration as properties to gatling-maven-plugin

**URL:** <https://community.gatling.io/t/passing-duration-as-properties-to-gatling-maven-plugin/5180>\
**Category:** Gatling (Open-Source)\
**Created:** [August 14, 2019, 12:55pm UTC](https://community.gatling.io/t/passing-duration-as-properties-to-gatling-maven-plugin/5180 "2019-08-14T12:55:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hak](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@hak](https://community.gatling.io/u/hak)\
**Post date:** [August 14, 2019, 12:55pm UTC](https://community.gatling.io/t/passing-duration-as-properties-to-gatling-maven-plugin/5180/1 "2019-08-14T12:55:36Z")

</div>

I have been passing properties to Gatling using the gatling-maven-plugin for a long time and it works flawlessly. However, I have stumbled upon an issue that I cannot seem to get around:

I basically want to pass my setUp() from the command line to Gatling.

So this works:

```auto
numUsers = System.getProperty("mytest.numUsers").asInstanceOf[Int]

```

…however this does not:

```auto
pauseTime = Duration.apply(System.getProperty("mytest.pauseTime"))

```

To answer your first question, this excerpt is part of a case class, so no vals in the lines above.

Validating the code using the Scala console works fine - I can set the system property, read it back and apply the string and get a Duration without any issues. It is providing the duration as a string (“1 second”) on the command line that is a problem to me right now.

I have tried passing the following:  
**-Dmytest.pauseTime="1 second"**  
or…  
**"-Dmytest.pausetime=1 second"**  
Result:

[INFO] — gatling-maven-plugin:3.0.3:test (default-cli) @ userinput —  
14:46:53.904 [ERROR] i.g.a.Gatling$ - Run crashed  
java.lang.NumberFormatException: format error “1 second”  
at scala.concurrent.duration.Duration$.apply(Duration.scala:69)  
at mypackage.config.Scenarios$.(Scenarios.scala:79)  
at mypackage.config.Scenarios$.(Scenarios.scala)  
… 17 common frames omitted  
Wrapped by: java.lang.ExceptionInInitializerError: null  
at mypackage.UserInputSimulation.(UserInputSimulation.scala:18)  
… 16 common frames omitted

**-Dmytest.pauseTime=1\ second**  
Result:

[ERROR] Unknown lifecycle phase “second”. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. → [Help 1]  
org.apache.maven.lifecycle.LifecyclePhaseNotFoundException: Unknown lifecycle phase “second”. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.

Does anyone have any pointers for me here?

Thanks,  
Håkan

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [August 14, 2019, 12:59pm UTC](https://community.gatling.io/t/passing-duration-as-properties-to-gatling-maven-plugin/5180/2 "2019-08-14T12:59:27Z")

</div>

The best you can do is

```auto
pauseTime = System.getProperty("mytest.pauseTime").toInt seconds

```
