Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/it/dependency-filesets-resources-test/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

invoker.goals = clean generate-resources
123 changes: 123 additions & 0 deletions src/it/dependency-filesets-resources-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?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>dependency-filesets-resources-test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Test for the dependency resources reference of the dependencyfilesets task</name>
<description>Test for the dependency resources reference of the dependencyfilesets task</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
<id>antrun</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>

<dependencyfilesets prefix="test."/>
<mkdir dir="target/dependencies"/>
<copy todir="target/dependencies" flatten="true">
<resources refid="test.maven.project.dependencies.resources"/>
</copy>

</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!-- set versions of default bindings plugins to avoid warning added in MNG-6562 -->
<plugin><!-- clean lifecycle -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>@version.maven-clean-plugin@</version>
</plugin>
<plugin><!-- site lifecycle -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>@version.maven-site-plugin@</version>
</plugin>
<!-- default lifecycle jar packaging -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>@version.maven-resources-plugin@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>@version.maven-compiler-plugin@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>@version.maven-surefire@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>@version.maven-jar-plugin@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>@version.maven-install-plugin@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>@version.maven-deploy-plugin@</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>@version.ant@</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>@versions.junit5@</version>
</dependency>
</dependencies>


</project>
29 changes: 29 additions & 0 deletions src/it/dependency-filesets-resources-test/src/main/java/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

/*
* 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.
*/

public class Test
{

public static void main( String args[] )
{
System.out.println( "done" );
}

}
50 changes: 50 additions & 0 deletions src/it/dependency-filesets-resources-test/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

/*
* 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.
*/

import java.io.*;
import java.util.*;
import java.util.regex.*;

import org.codehaus.plexus.util.*;

try
{
File depsDir = new File( basedir, "target/dependencies" );
File antJar = new File( depsDir, "ant-" + scriptVarVersionAnt + ".jar" );
File junitJar = new File( depsDir, "junit-jupiter-engine-" + scriptVarVersionJunit + ".jar" );

if ( ! antJar.exists() || antJar.isDirectory() )
{
System.out.println( "Ant jar file does not exist: " + antJar );
return false;
}
if ( ! junitJar.exists() || junitJar.isDirectory() )
{
System.out.println( "Junit jar file does not exist: " + junitJar );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.maven.ant.tasks.support.SpecificScopesArtifactFilter;
import org.apache.maven.ant.tasks.support.TypesArtifactFilter;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-17-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-25-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-25-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-8-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-21-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-25-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-21-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-8-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-21-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-21-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 28 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-25-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated
import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
import org.apache.maven.plugins.antrun.AntRunMojo;
import org.apache.maven.plugins.antrun.taskconfig.DependencyFilesetsConfiguration;
Expand All @@ -33,6 +33,7 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.resources.Union;

/**
* Ant task which create a fileset for each dependency in a Maven project, and a
Expand Down Expand Up @@ -62,7 +63,7 @@

FileSet dependenciesFileSet = new FileSet();
dependenciesFileSet.setProject(getProject());
ArtifactRepository localRepository = getProject().getReference("maven.local.repository");

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-17-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-25-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-25-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-8-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-21-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-25-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-21-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-8-zulu 3.10.0-rc-1

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / macos-latest jdk-21-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-21-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated

Check warning on line 66 in src/main/java/org/apache/maven/ant/tasks/DependencyFilesetsTask.java

View workflow job for this annotation

GitHub Actions / Verify / ubuntu-latest jdk-25-zulu 4.0.0-rc-6

org.apache.maven.artifact.repository.ArtifactRepository in org.apache.maven.artifact.repository has been deprecated
dependenciesFileSet.setDir(new File(localRepository.getBasedir()));

if (depArtifacts.isEmpty()) {
Expand All @@ -72,6 +73,9 @@
dependenciesFileSet.createExclude().setName("**");
}

Union dependenciesResourcesFileSet = new Union();
dependenciesResourcesFileSet.setProject(getProject());

for (Artifact artifact : depArtifacts) {
String relativeArtifactPath = localRepository.pathOf(artifact);
dependenciesFileSet.createInclude().setName(relativeArtifactPath);
Expand All @@ -81,10 +85,12 @@
FileSet singleArtifactFileSet = new FileSet();
singleArtifactFileSet.setProject(getProject());
singleArtifactFileSet.setFile(artifact.getFile());
dependenciesResourcesFileSet.add(singleArtifactFileSet);
getProject().addReference(fileSetName, singleArtifactFileSet);
}

getProject().addReference((getPrefix() + getProjectDependenciesId()), dependenciesFileSet);
getProject().addReference((getPrefix() + getProjectDependenciesResourcesId()), dependenciesResourcesFileSet);
}

/**
Expand Down Expand Up @@ -162,6 +168,21 @@
this.configuration.setProjectDependenciesId(projectDependenciesId);
}

/**
* @return RefId for the resource collection containing all project dependencies - default
* maven.project.dependencies.resources
*/
public String getProjectDependenciesResourcesId() {
return this.configuration.getProjectDependenciesResourcesId();
}

/**
* @param projectDependenciesResourcesId RefId for the resource collection containing all project dependencies
*/
public void setProjectDependenciesResourcesId(String projectDependenciesResourcesId) {
this.configuration.setProjectDependenciesResourcesId(projectDependenciesResourcesId);
}

/**
* Filter a set of artifacts using the scopes and type filters.
*
Expand Down
7 changes: 7 additions & 0 deletions src/main/mdo/antrun.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ under the License.
<defaultValue>maven.project.dependencies</defaultValue>
<description>RefId for the fileset containing all project dependencies</description>
</field>
<field xml.attribute="true">
<name>projectDependenciesResourcesId</name>
<type>String</type>
<defaultValue>maven.project.dependencies.resources</defaultValue>
<description>RefId for the resource collection containing all project dependencies, resolved from the actual
artifact files</description>
</field>
<field xml.attribute="true">
<name>scopes</name>
<type>String</type>
Expand Down
Loading
Loading