testing - Maven scope test needs to resolve depdencies -


i have dependency in pom <scope>test</scope>. understood scope concept of maven dependency should required during test builds. nevertheless maven trys download dependency during mvn package why following build failure:

[info] build failure [info] ------------------------------------------------------------------------ [info] total time: 0.278 s [info] finished at: 2016-04-19t22:11:59+02:00 [info] final memory: 5m/15m [info] ------------------------------------------------------------------------ [error] failed execute goal on project my-module: not resolve dependencies project com.mycompany.app:my-module:jar:1: failure find group-a:artifact-b:jar:tests:1.0 in https://repo.maven.apache.org/maven2 cached in local repository, resolution not reattempted until update interval of central has elapsed or updates forced -> [help 1]0  

i use following pom:

<project>  <modelversion>4.0.0</modelversion>  <groupid>com.mycompany.app</groupid>  <artifactid>my-module</artifactid>  <version>1</version>  <dependencies>    <dependency>      <groupid>group-a</groupid>      <artifactid>artifact-b</artifactid>      <version>1.0</version>      <scope>test</scope>   </dependency>  </dependencies> </project> 
  1. is intended behavior of maven?
  2. are there mitigations ignore dependency during package/install/deploy builds?

any appreciated

i couldn't solve issue, found comfortable way mitigate problem. durring package use -dmaven.test.skip=true parameter. defined 2 profiles 1 dependency , 1 without. when tests skipped deactivate profile dependency.

nevertheless appreciate solution scope tag

<project>  <modelversion>4.0.0</modelversion>  <groupid>com.mycompany.app</groupid>  <artifactid>my-module</artifactid>  <version>1</version>     <profiles>       <profile>         <id>default</id>         <activation>         <activebydefault>true</activebydefault>         </activation>         <dependencies>           <dependency>             <groupid>group-a</groupid>             <artifactid>artifact-b</artifactid>             <version>1.0</version>           </dependency>         </dependencies>       </profile>         <profile>         <id>skip-tests</id>         <activation>           <property>             <name>maven.test.skip</name>             <value>true</value>           </property>         </activation>       </profile>     </profiles> </project> 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -