title: How to get Maven groupId, artifactId & project version to the command line
body: <p>I would like to retrieve from the command line the <em>groupId, the artifactId &amp; the version</em> of a Maven project.</p>
  
  <p>The proposed solution in this topic "<a href="https://stackoverflow.com/questions/3545292/how-to-get-maven-project-version-to-the-bash-command-line">How to get Maven project version to the bash command line</a>" is to use the following plugin:</p>
  
  <p><code>mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.artifactId</code></p>
  
  <p>It works well but I can't figure out how to set, at the same time, the <code>project.groupId, project.artifactId &amp; project.version</code> to the <em>-Dexpression</em> argument.</p>
  
  <p>I would avoid launching 3 times the Maven command with a different <em>-Dexpression</em> argument each time...</p>
  
  <p>Thks</p>
  
  <p><hr>
  For the moment, I retrieve data by doing the following:</p>
  
  <pre><code>local pom_groupid=`mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.groupId |grep -Ev '(^\[|Download\w+:)'`
  local pom_artifactid=`mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.artifactId |grep -Ev '(^\[|Download\w+:)'`
  local pom_version=`mvn org.apache.maven.plugins:maven-help-plugin:2.2:evaluate -Dexpression=project.version |grep -Ev '(^\[|Download\w+:)'`
  </code></pre>