title: Setting properties via Maven command line
body: <p>I'm confused about the correct way to set a property for some unit tests via the command line when using Maven. There are a number of questions (e.g. <a href="https://stackoverflow.com/q/7527789/820657">Specifying Maven memory parameter without setting MAVEN_OPTS environment variable</a>, <a href="https://stackoverflow.com/q/12525288/820657">Is there a way to pass jvm args via command line to maven?</a>, <a href="https://stackoverflow.com/q/7579776/820657">How to set JVM parameters for Junit Unit Tests?</a>) that touch on this subject but none have the answer I'm looking for. </p>
  
  <p>I want to set the property <code>java.util.logging.config.class</code> to some value but I don't want to set the <code>MAVEN_OPTS</code> environment variable.</p>
  
  <p>I can configure the surefire plugin in my pom file with the property:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;argLine&gt;-Djava.util.logging.config.class=someClass&lt;/argLine&gt;
  </code></pre>
  
  <p>so that it is set every time the test phase is run.</p>
  
  <p>However, if I remove the setting from the pom file and add the following to the command line:</p>
  
  <pre><code>mvn package -DargLine="java.util.logging.config.class=someClass"
  </code></pre>
  
  <p>then the following error in the test phase is reported and the build fails:</p>
  
  <blockquote>
    <p>Error: Could not find or load main class java.util.logging.config.class=someClass</p>
  </blockquote>
  
  <p>If I run the following from the command line:</p>
  
  <pre><code>mvn package -Djava.util.logging.config.class=someClass
  </code></pre>
  
  <p>then the following error is reported at the beginning of the build but the build and tests are successful:</p>
  
  <blockquote>
    <p>Logging configuration class "someClass" failed
        java.lang.ClassNotFoundException: someClass</p>
  </blockquote>
  
  <p>I don't really understand the behaviour. Can someone enlighten me?</p>