[
https://issues.apache.org/jira/browse/MDEP-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826012#comment-16826012
]
Andy Lehane commented on MDEP-650:
----------------------------------
I've been working on a fix for this, which is based on the following ideas:
AbstractFromConfigurationMojo:
* - Add a new method called, resolveArtifactRanges
* - Call resolveArtifactRanges in the getProcessedArtifactItems method as the
first call after the log statement when looping around each artifact item.
* - The resolveArtifactRanges method performs the following logic:
# Constructs a version range from the artifactItem's version property, if the
range has no restrictions, no processing is required.
# If the version range has restrictions, then try and find a match in the
projects list of already resolved dependencies (i.e.
project.getDependencyArtifacts()).
# If the artifact is not found in the project.getDepencencyArtifacts list,
then use the Maven DependencyResolver (injected into the Mojo using the
@Component annotation).
# If an artifact has been resolved to a specific version, then update the
artifactItem's version property with the resolved version.
# If the artifact cannot be resolved, then leave the version alone
(maintaining backwards compatibility)
> dependency:unpack doesn't seem to handle version ranges
> -------------------------------------------------------
>
> Key: MDEP-650
> URL: https://issues.apache.org/jira/browse/MDEP-650
> Project: Maven Dependency Plugin
> Issue Type: Bug
> Components: unpack
> Affects Versions: 3.1.1
> Reporter: Andy Lehane
> Priority: Minor
>
> This call is a reopened version of MDEP-50.
>
> I have a maven-dependency-plugin configuration of:
> {code:java}
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>unpack common-lang example</id>
> <phase>process-resources</phase>
> <goals>
> <goal>unpack</goal>
> </goals>
> <configuration>
> <artifactItems>
> <artifactItem>
> <groupId>common-lang</groupId>
> <artifactId>common-lang</artifactId>
> <version>[0,)</version>
> <type>jar</type>
> <overWrite>true</overWrite>
> <outputDirectory>${project.build.directory}/test</outputDirectory>
> </artifactItem>
> </artifactItems>
> </configuration>
> </execution>
> </executions>
> </plugin>
> {code}
> When this is run using maven 3.6.0 and the maven-dependency-plugin version
> 3.1.1, the following error is produced:
>
> {code:java}
> [INFO] --- maven-dependency-plugin:3.1.1:unpack (unpack common-lang example)
> @ MavenDependencyPluginTestBed ---
> [INFO] Configured Artifact: common-lang:common-lang:[0,):jar
> Downloading from central-proxy:
> http://internal-repo/repository/central/common-lang/common-lang/%5B0,)/common-lang-%5B0,).pom
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ---------------------------------------------------------------
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)