title: How to compile a single file with maven?
body: <p>I set up a working maven project with <code>mvn archetype:create ...</code>
  I can compile all the sources with <code>mvn compile</code> but I want to be able to compile also a single file at time.</p>
  
  <p>There is a way to ask maven to compile an arbitrary single .java file?</p>
  
  <p>Thanks</p>
  
  <p><strong>Updates 1:</strong></p>
  
  <p>I would specify the single file on the command line. I would choose the file at the moment of the command launch. I wouldn't modify the pom.xml.</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Why I asked this? Because I would use <code>autotest-java</code> with the Vim editor. </p>
  
  <p><code>autotest-java</code> is an hack/extension of ZenTest (which is a Ruby application that automatically launch unit tests on every save of a Ruby file). </p>
  
  <p><code>autotest-java</code> requires a maven project structure and requires that your editor/IDE perform "compile on save". In fact it doesn't recognize when a .java file is modified but instead it monitors for .class files for modifications. </p>
  
  <p>I succesfully used autotest-java with Netbeans (which support "compile on save") but I would use it with Vim.</p>