Maven authentication to Sonatype Nexus repository

You should have a file named settings.xml under $HOME/.m2 (under unix, no idea about windows) with the following content

<settings>
  <servers>
    <server>
      <id>my-repo</id>
      <username>myname</username>
      <password>******</password>
    </server>
  </servers>
</settings>

where my-repo is the id of the repository in your pom.xml:

<distributionManagement>
    <repository>
        <id>my-repo</id>
        <url>http://my-repo.url</url>
    </repository>
</distributionManagement>