title: Spring Property From Command Line
body: <p>I've a Spring Profile enabled app with two profiles [cat|dog] and running with desired profile is fine in Idea using Maven:</p>
  
  <p>clean compile package exec:java -Dspring.profiles.active=dog</p>
  
  <p>I wish to run the packaged jar from command line but can't seem to find the right syntax to set the profile.  I've tried the follwing but none are correct:</p>
  
  <pre><code>java -cp myShadedJar-1.0-SO-static.jar org.my.package.Main --spring.profiles.active=dog
  
  java -cp myShadedJar-1.0-SO-static.jar org.my.package.Main -Drun.arguments="--spring.profiles.active=dog"
  
  java -cp myShadedJar-1.0-SO-static.jar org.my.package.Main -Drun.arguments="spring.profiles.active=dog"
  
  java -cp myShadedJar-1.0-SO-static.jar org.my.package.Main -Dspring.profiles.active=dog
  </code></pre>
  
  <p>What's the correct way to pass a Spring property when running from CLI?</p>
  
  <p>Thanks in advance,
  KA.</p>