[ https://jira.codehaus.org/browse/MNG-5177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stanislav Ochotnicky updated MNG-5177: -------------------------------------- Attachment: 0001-Fix-text-scope-skipping-with-maven.test.skip.patch Maven patch/hack fixing the problem > Maven adds tests dependecies into depgraph even when skipping tests > ------------------------------------------------------------------- > > Key: MNG-5177 > URL: https://jira.codehaus.org/browse/MNG-5177 > Project: Maven 2 & 3 > Issue Type: Bug > Affects Versions: 3.0.3 > Reporter: Stanislav Ochotnicky > Priority: Minor > Attachments: 0001-Fix-text-scope-skipping-with-maven.test.skip.patch > > > Maven 3.x adds test dependencies into dependency graph even when we use > -Dmaven.test.skip=true. This means unnecessary downloading of artifacts and > failure of build if the repository with test dependencies is offline. > I was able to solve this by patching maven in following way: > 1. add new DependencySelector implementation that looks at environment > variables and omits test dependencies when maven.test.skip property is found > 2. modify maven-compat as well so that old code paths work the same way. > Maybe a better way to do part 1 would be to modify ScopeDependencySelector, > and if that's the preferred way I can rework the patch that way. > I had several issues with the implementation: > 1. For some reason I wasn't able to get property definition from > MavenSession so I used System.getProperty directly. Any idea what might be > the reason? > 2. Is there perhaps a better way to figure out that tests are being skipped > instead of looking for "maven.test.skip" property? > 3. I had to copy non-test artifacts of dependencies in > DefaultArtifactResolver because original implementation didn't provide > "remove" method. Not a big deal I guess, but worth a note. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira