title: Maven add a repository for a specific OS
body: <p>I am new to maven and I am trying to create a single pom file for both linux and windows. For dependency resolution, I have 2 p2 repositories. 1 for windows and the other is for linux.
  I also have a target definition (.target) in which I am adding all external repositories for dependecy resolution.
  Is there a way that I can add/activate a repository location per OS? Below is my trial.</p>
  
  <p>Using maven pom profiles:<br>
  In this trial, I added all my repositories (common for windows and linux) to the target definition. I then created 2 new profiles and added the OS-specific p2 repo like so</p>
  
  <pre><code>&lt;profile&gt;
    &lt;id&gt;Linux&lt;/id&gt;
    &lt;activation&gt;
      &lt;activeByDefault&gt;false&lt;/activeByDefault&gt;
      &lt;os&gt;&lt;name&gt;linux&lt;/name&gt;&lt;/os&gt;
    &lt;/activation&gt;
    &lt;repositories&gt;
    &lt;repository&gt;
      &lt;id&gt;p2_lin&lt;/id&gt;
      &lt;url&gt;http://example.com/data/LINUX_P2&lt;/url&gt;
      &lt;layout&gt;p2&lt;/layout&gt;
    &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;/profile&gt;
  &lt;profile&gt;
    &lt;id&gt;Windows&lt;/id&gt;
    &lt;activation&gt;
      &lt;activeByDefault&gt;false&lt;/activeByDefault&gt;
      &lt;os&gt;&lt;name&gt;win32&lt;/name&gt;&lt;/os&gt;
    &lt;/activation&gt;
    &lt;repositories&gt;
    &lt;repository&gt;
      &lt;id&gt;trace_p2_win&lt;/id&gt;
      &lt;url&gt;http://example.com/data/WINDOWS_P2&lt;/url&gt;
      &lt;layout&gt;p2&lt;/layout&gt;
    &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p>
  While calling maven, I add this profile to the parameters <code>mvn clean install -PWindows,Test</code></p>
  
  <p>Unfortunately, the above configuration gives an unsatisfied dependency.
  But when I remove this section from the parent pom file and add the correct repository (example: ><a href="http://example.com/data/WINDOWS_P2" rel="nofollow noreferrer">http://example.com/data/WINDOWS_P2</a>) to the target definition without the other one, everything seems to be fine.</p>