Author: gboue
Date: Sat Jun 17 19:54:34 2017
New Revision: 1799020
URL: http://svn.apache.org/viewvc?rev=1799020&view=rev
Log:
[MANTRUN-192] filterArtifacts in DependencyFilesetsTask includes entire
maven.local.repository
When there are no artifacts after filtering, Ant will include by default
everything under the local repository (since there are no include patterns).
Therefore, in this case, we need to exclude everything explicitly. For
performance reasons, we need to add a dummy file to the include patterns,
otherwise Ant will still traverse the whole directory before applying the
exclusions.
Added:
maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/
maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/pom.xml (with
props)
Modified:
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java
Added: maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/pom.xml?rev=1799020&view=auto
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/pom.xml (added)
+++ maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/pom.xml Sat Jun
17 19:54:34 2017
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins.antrun</groupId>
+ <artifactId>MANTRUN-192</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0</version>
+ <url>https://issues.apache.org/jira/browse/MANTRUN-192</url>
+ <description>Checks that creating a FileSet of the project dependencies also
works when there are no dependencies.</description>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>@pom.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <target>
+ <dependencyfilesets />
+ <property name="deps" refid="maven.project.dependencies"/>
+ <fail message="Dependency list should have been empty:
${deps}">
+ <condition>
+ <not>
+ <equals arg1="${deps}" arg2=""/>
+ </not>
+ </condition>
+ </fail>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/MANTRUN-192/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java?rev=1799020&r1=1799019&r2=1799020&view=diff
==============================================================================
---
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java
(original)
+++
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java
Sat Jun 17 19:54:34 2017
@@ -116,6 +116,14 @@ public class DependencyFilesetsTask
ArtifactRepository localRepository = (ArtifactRepository)
getProject().getReference( "maven.local.repository" );
dependenciesFileSet.setDir( new File( localRepository.getBasedir() ) );
+ if ( depArtifacts.isEmpty() )
+ {
+ // For performance reasons in case of huge local repo, tell Ant to
include a single thing, otherwise the
+ // whole directory is scanned (even though ** is excluded).
+ dependenciesFileSet.createInclude().setName( "." );
+ dependenciesFileSet.createExclude().setName( "**" );
+ }
+
for ( Artifact artifact : depArtifacts )
{
String relativeArtifactPath = localRepository.pathOf( artifact );