title: Maven "import" scope
body: <p>I have module and tests for that module.
  Tests need resteasy-client, but module doesn't.
  I don't want mix module dependencies and dependencies for tests, how can i do this? I trying to use maven 'import' scope.
  <strong>pom.xml:</strong></p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;ru.my.project&lt;/groupId&gt;
          &lt;artifactId&gt;my-parent&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;my-module-1&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;name&gt;This is one of my modules&lt;/name&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ru.my.project&lt;/groupId&gt;
              &lt;artifactId&gt;my-module-2&lt;/artifactId&gt;
              &lt;version&gt;${project.version}&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  &lt;!--I want to import dependencies for test from this pom:--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ru.my.project.test&lt;/groupId&gt;
              &lt;artifactId&gt;my-module-1-test&lt;/artifactId&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;version&gt;1.0&lt;/version&gt;
              &lt;scope&gt;import&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>and <strong>my-module-1.pom</strong> in local nexus repository:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;ru.my.project.test&lt;/groupId&gt;
      &lt;artifactId&gt;my-module-1-test&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;name&gt;Dependencies for testing module-1&lt;/name&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;    
              &lt;dependency&gt;
                  &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
                  &lt;artifactId&gt;resteasy-client&lt;/artifactId&gt;
                  &lt;version&gt;3.0.11.Final&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
                  &lt;artifactId&gt;resteasy-jaxrs&lt;/artifactId&gt;
                  &lt;version&gt;3.0.11.Final&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
                  &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
                  &lt;version&gt;4.5&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;     
  &lt;/project&gt;
  </code></pre>
  
  <p>I seems that mvn sees this file, but compilation fails:</p>
  
  <blockquote>
    <p>[ERROR] /home/xxx.java:[5,38] error: package org.jboss.resteasy.client.jaxrs does not exist 
    [ERROR] /home/xxx.java:[6,38] error: package org.jboss.resteasy.client.jaxrs does not exist 
    [ERROR] /home/xxx.java:[7,38] error: package org.jboss.resteasy.client.jaxrs does not exist</p>
  </blockquote>
  
  <p>But when I copy-paste those dependensies in module-1`s pom.xml everything is fine! But I don't want to mix, it becomes unreadable fast.</p>