[Git][java-team/maven-file-management][upstream] New upstream version 3.1.0
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Thu Nov 5 16:52:31 GMT 2026
Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / maven-file-management
Commits:
3dec84a5 by Emmanuel Bourg at 2022-10-10T15:02:01+02:00
New upstream version 3.1.0
- - - - -
21 changed files:
- + .asf.yaml
- + .gitignore
- + Jenkinsfile
- + README.md
- pom.xml
- src/main/java/org/apache/maven/shared/model/fileset/mappers/FileNameMapper.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/FlatFileNameMapper.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/GlobPatternMapper.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/IdentityMapper.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperUtil.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/MergingMapper.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/PackageNameMapper.java
- + src/main/java/org/apache/maven/shared/model/fileset/mappers/RegexpPatternMapper.java
- src/main/java/org/apache/maven/shared/model/fileset/mappers/UnPackageNameMapper.java
- src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java
- src/main/mdo/fileset.mdo
- src/site/site.xml
- src/site/xdoc/download.xml.vm
- src/test/java/org/apache/maven/shared/model/fileset/mappers/MapperUtilTest.java
- src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
Changes:
=====================================
.asf.yaml
=====================================
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+# see https://s.apache.org/asfyaml
+github:
+ description: "Apache Maven File Management API"
+ homepage: https://maven.apache.org/shared/file-management/
+ labels:
+ - java
+ - build-management
+ - maven-shared
+ - maven
=====================================
.gitignore
=====================================
@@ -0,0 +1,17 @@
+target/
+.project
+.classpath
+.settings/
+.checkstyle
+.svn/
+bin/
+# Intellij
+*.ipr
+*.iml
+.idea
+out/
+.DS_Store
+/bootstrap
+/dependencies.xml
+.java-version
+.checkstyle
=====================================
Jenkinsfile
=====================================
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+
+asfMavenTlpStdBuild()
=====================================
README.md
=====================================
@@ -0,0 +1,99 @@
+<!---
+ 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.
+-->
+Contributing to [Apache Maven File Management API](https://maven.apache.org/shared/file-management/)
+======================
+
+[][jira]
+[][license]
+[](https://search.maven.org/artifact/org.apache.maven.shared/file-management)
+[][build]
+[][test-results]
+
+
+You have found a bug or you have an idea for a cool new feature? Contributing
+code is a great way to give something back to the open source community. Before
+you dig right into the code, there are a few guidelines that we need
+contributors to follow so that we can have a chance of keeping on top of
+things.
+
+Getting Started
+---------------
+
++ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
++ Make sure you have a [GitHub account](https://github.com/signup/free).
++ If you're planning to implement a new feature, it makes sense to discuss your changes
+ on the [dev list][ml-list] first.
+ This way you can make sure you're not wasting your time on something that isn't
+ considered to be in Apache Maven's scope.
++ Submit a ticket for your issue, assuming one does not already exist.
+ + Clearly describe the issue, including steps to reproduce when it is a bug.
+ + Make sure you fill in the earliest version that you know has the issue.
++ Fork the repository on GitHub.
+
+Making and Submitting Changes
+--------------
+
+We accept Pull Requests via GitHub. The [developer mailing list][ml-list] is the
+main channel of communication for contributors.
+There are some guidelines which will make applying PRs easier for us:
++ Create a topic branch from where you want to base your work (this is usually the master branch).
+ Push your changes to a topic branch in your fork of the repository.
++ Make commits of logical units.
++ Respect the original code style: by using the same [codestyle][code-style],
+ patches should only highlight the actual difference, not being disturbed by any formatting issues:
+ + Only use spaces for indentation.
+ + Create minimal diffs - disable on save actions like reformat source code or organize imports.
+ If you feel the source code should be reformatted, create a separate PR for this change.
+ + Check for unnecessary whitespace with `git diff --check` before committing.
++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
+```
+[MSHARED-XXX] - Subject of the JIRA Ticket
+ Optional supplemental description.
+```
++ Make sure you have added the necessary tests (JUnit/IT) for your changes.
++ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken.
++ Submit a pull request to the repository in the Apache organization.
++ Update your JIRA ticket and include a link to the pull request in the ticket.
+
+If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla].
+
+Making Trivial Changes
+----------------------
+
+For changes of a trivial nature to comments and documentation, it is not always
+necessary to create a new ticket in JIRA. In this case, it is appropriate to
+start the first line of a commit with '(doc)' instead of a ticket number.
+
+Additional Resources
+--------------------
+
++ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch)
++ [Apache Maven Shared Components project page][jira]
++ [Contributor License Agreement][cla]
++ [General GitHub documentation](https://help.github.com/)
++ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
++ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject)
++ #Maven IRC channel on freenode.org
+
+[jira]: https://issues.apache.org/jira/projects/MSHARED/
+[license]: https://www.apache.org/licenses/LICENSE-2.0
+[ml-list]: https://maven.apache.org/mailing-lists.html
+[code-style]: https://maven.apache.org/developers/conventions/code.html
+[cla]: https://www.apache.org/licenses/#clas
+[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index
+[test-results]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-file-management/job/master/lastCompletedBuild/testReport/
+[build]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-file-management/job/master/
=====================================
pom.xml
=====================================
@@ -26,12 +26,12 @@
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
- <version>22</version>
- <relativePath>../../pom/maven/maven-shared-components/pom.xml</relativePath>
+ <version>36</version>
+ <relativePath />
</parent>
<artifactId>file-management</artifactId>
- <version>3.0.0</version>
+ <version>3.1.0</version>
<name>Apache Maven File Management API</name>
<description>API to collect files from a given directory using several include/exclude rules.</description>
@@ -43,60 +43,57 @@
</contributor>
</contributors>
- <prerequisites>
- <maven>${mavenVersion}</maven>
- </prerequisites>
-
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/maven/shared/tags/file-management-3.0.0</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/shared/tags/file-management-3.0.0</developerConnection>
- <url>http://svn.apache.org/viewvc/maven/shared/tags/file-management-3.0.0</url>
+ <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-file-management.git</connection>
+ <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-file-management.git</developerConnection>
+ <url>https://github.com/apache/maven-file-management/tree/${project.scm.tag}</url>
+ <tag>file-management-3.1.0</tag>
</scm>
<issueManagement>
<system>jira</system>
- <url>https://issues.apache.org/jira/browse/MSHARED/component/12326425</url>
+ <url>https://issues.apache.org/jira/browse/MSHARED/</url>
</issueManagement>
<distributionManagement>
<site>
<id>apache.website</id>
- <url>scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/components/${maven.site.path}</url>
+ <url>scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path}</url>
</site>
</distributionManagement>
<properties>
- <mavenVersion>3.0</mavenVersion>
- <maven.compiler.target>1.6</maven.compiler.target>
- <maven.compiler.source>1.6</maven.compiler.source>
+ <javaVersion>8</javaVersion>
+ <slf4jVersion>1.7.36</slf4jVersion>
+ <project.build.outputTimestamp>2022-06-29T11:19:57Z</project.build.outputTimestamp>
</properties>
<dependencies>
- <!-- Maven -->
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${mavenVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-io</artifactId>
- <version>3.0.0</version>
- </dependency>
-
<dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.0.0</version>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>3.0.22</version>
+ <version>3.4.2</version>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.11.0</version>
+ </dependency>
+
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.11</version>
+ <version>4.13.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -107,7 +104,6 @@
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<configuration>
- <useJava5>true</useJava5>
<version>1.1.0</version>
<models>
<model>src/main/mdo/fileset.mdo</model>
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/FileNameMapper.java
=====================================
@@ -20,30 +20,27 @@ package org.apache.maven.shared.model.fileset.mappers;
*/
/**
- * Interface to be used by SourceFileScanner.
- *
- * <p>Used to find the name of the target file(s) corresponding to a
- * source file.</p>
+ * Interface used by SourceFileScanner
+ * to find the name of the target file(s) corresponding to a
+ * source file.
*
* <p>The rule by which the file names are transformed is specified
* via the setFrom and setTo methods. The exact meaning of these is
* implementation dependent.</p>
- *
- * @version $Id: FileNameMapper.java 1721672 2015-12-25 13:18:36Z khmarbaise $
*/
public interface FileNameMapper
{
/**
* Sets the from part of the transformation rule.
*
- * @param from The source.
+ * @param from the source
*/
void setFrom( String from );
/**
* Sets the to part of the transformation rule.
*
- * @param to The destination.
+ * @param to the destination
*/
void setTo( String to );
@@ -51,12 +48,12 @@ public interface FileNameMapper
* Returns the target filename for the
* given source file.
*
- * <p>if the given rule doesn't apply to the source file,
- * implementation must return null. SourceFileScanner will then
+ * <p>If the given rule doesn't apply to the source file,
+ * the implementation must return null. SourceFileScanner will then
* omit the source file in question.</p>
*
- * @param sourceFileName the name of the source file relative to some given basedirectory.
- * @return the target filename for the given source file.
+ * @param sourceFileName the name of the source file relative to some given base directory
+ * @return the target filename for the given source file
*/
String mapFileName( String sourceFileName );
}
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/FlatFileNameMapper.java
=====================================
@@ -19,33 +19,33 @@ package org.apache.maven.shared.model.fileset.mappers;
* under the License.
*/
+import java.io.File;
+
/**
* Implementation of FileNameMapper that always returns the source
* file name without any leading directory information.
*
* <p>This is the default FileNameMapper for the copy and move
* tasks if the flatten attribute has been set.</p>
- *
- * @version $Id: FlatFileNameMapper.java 661727 2008-05-30 14:21:49Z bentmann $
*/
public class FlatFileNameMapper
implements FileNameMapper
{
- /** {@inheritDoc} */
+ @Override
public void setFrom( String from )
{
// nop
}
- /** {@inheritDoc} */
+ @Override
public void setTo( String to )
{
// nop
}
- /** {@inheritDoc} */
+ @Override
public String mapFileName( String sourceFileName )
{
- return new String( new java.io.File( sourceFileName ).getName() );
+ return new File( sourceFileName ).getName();
}
}
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/GlobPatternMapper.java
=====================================
@@ -30,8 +30,6 @@ package org.apache.maven.shared.model.fileset.mappers;
*
* <p>This is one of the more useful Mappers, it is used by <code>javac</code> for
* example.</p>
- *
- * @version $Id: GlobPatternMapper.java 1721579 2015-12-23 21:08:39Z khmarbaise $
*/
public class GlobPatternMapper
implements FileNameMapper
@@ -91,7 +89,7 @@ public class GlobPatternMapper
this.caseSensitive = caseSensitive;
}
- /** {@inheritDoc} */
+ @Override
public void setFrom( String from )
{
int index = from.lastIndexOf( "*" );
@@ -109,7 +107,7 @@ public class GlobPatternMapper
postfixLength = fromPostfix.length();
}
- /** {@inheritDoc} */
+ @Override
public void setTo( String to )
{
int index = to.lastIndexOf( "*" );
@@ -125,7 +123,7 @@ public class GlobPatternMapper
}
}
- /** {@inheritDoc} */
+ @Override
public String mapFileName( String sourceFileName )
{
if ( fromPrefix == null || !modifyName( sourceFileName ).startsWith( modifyName( fromPrefix ) )
@@ -133,7 +131,7 @@ public class GlobPatternMapper
{
return null;
}
- return new String( toPrefix + extractVariablePart( sourceFileName ) + toPostfix );
+ return toPrefix + extractVariablePart( sourceFileName ) + toPostfix;
}
/**
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/IdentityMapper.java
=====================================
@@ -24,25 +24,23 @@ package org.apache.maven.shared.model.fileset.mappers;
*
* <p>This is the default FileNameMapper for the copy and move
* tasks.</p>
- *
- * @version $Id: IdentityMapper.java 661727 2008-05-30 14:21:49Z bentmann $
*/
public class IdentityMapper
implements FileNameMapper
{
- /** {@inheritDoc} */
+ @Override
public void setFrom( String from )
{
// nop
}
- /** {@inheritDoc} */
+ @Override
public void setTo( String to )
{
// nop
}
- /** {@inheritDoc} */
+ @Override
public String mapFileName( String sourceFileName )
{
return sourceFileName;
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperException.java
=====================================
@@ -21,8 +21,6 @@ package org.apache.maven.shared.model.fileset.mappers;
/**
* Mapper Exception
- *
- * @version $Id: MapperException.java 1721672 2015-12-25 13:18:36Z khmarbaise $
*/
public class MapperException
extends Exception
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/MapperUtil.java
=====================================
@@ -20,7 +20,6 @@ package org.apache.maven.shared.model.fileset.mappers;
*/
import org.apache.maven.shared.model.fileset.Mapper;
-import org.apache.maven.shared.utils.io.IOUtil;
import java.io.IOException;
import java.io.InputStream;
@@ -28,8 +27,6 @@ import java.util.Properties;
/**
* Element to define a FileNameMapper.
- *
- * @version $Id: MapperUtil.java 1721672 2015-12-25 13:18:36Z khmarbaise $
*/
public final class MapperUtil
{
@@ -53,30 +50,19 @@ public final class MapperUtil
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
- InputStream stream = null;
-
- try
+ try ( InputStream stream = cloader.getResourceAsStream( MAPPER_PROPERTIES ) )
{
- stream = cloader.getResourceAsStream( MAPPER_PROPERTIES );
-
if ( stream == null )
{
throw new IllegalStateException( "Cannot find classpath resource: " + MAPPER_PROPERTIES );
}
- try
- {
- props.load( stream );
- implementations = props;
- }
- catch ( IOException e )
- {
- throw new IllegalStateException( "Cannot find classpath resource: " + MAPPER_PROPERTIES );
- }
+ props.load( stream );
+ implementations = props;
}
- finally
+ catch ( IOException e )
{
- IOUtil.close( stream );
+ throw new IllegalStateException( "Cannot find classpath resource: " + MAPPER_PROPERTIES );
}
}
}
@@ -86,7 +72,7 @@ public final class MapperUtil
*
* @param mapper {@link Mapper}
* @return {@link FileNameMapper}
- * @throws MapperException in case of an error.
+ * @throws MapperException in case of an error
*/
public static FileNameMapper getFileNameMapper( Mapper mapper )
throws MapperException
@@ -129,11 +115,7 @@ public final class MapperUtil
{
throw new MapperException( "Cannot find mapper implementation: " + classname, e );
}
- catch ( InstantiationException e )
- {
- throw new MapperException( "Cannot load mapper implementation: " + classname, e );
- }
- catch ( IllegalAccessException e )
+ catch ( InstantiationException | IllegalAccessException e )
{
throw new MapperException( "Cannot load mapper implementation: " + classname, e );
}
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/MergingMapper.java
=====================================
@@ -25,27 +25,25 @@ package org.apache.maven.shared.model.fileset.mappers;
*
* <p>This is the default FileNameMapper for the archiving tasks and
* up-to-date.</p>
- *
- * @version $Id: MergingMapper.java 1721672 2015-12-25 13:18:36Z khmarbaise $
*/
public class MergingMapper
implements FileNameMapper
{
private String mergedFile = null;
- /** {@inheritDoc} */
+ @Override
public void setFrom( String from )
{
// nop
}
- /** {@inheritDoc} */
+ @Override
public void setTo( String to )
{
mergedFile = to;
}
- /** {@inheritDoc} */
+ @Override
public String mapFileName( String sourceFileName )
{
return mergedFile;
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/PackageNameMapper.java
=====================================
@@ -29,13 +29,11 @@ import java.io.File;
* <mapper classname="org.apache.tools.ant.util.PackageNameMapper"
* from="*Test.java" to="${test.data.dir}/TEST-*Test.xml"/>
* </pre>
- *
- * @version $Id: PackageNameMapper.java 1721579 2015-12-23 21:08:39Z khmarbaise $
*/
public class PackageNameMapper
extends GlobPatternMapper
{
- /** {@inheritDoc} */
+ @Override
protected String extractVariablePart( String name )
{
String var = name.substring( prefixLength, name.length() - postfixLength );
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/RegexpPatternMapper.java
=====================================
@@ -0,0 +1,60 @@
+package org.apache.maven.shared.model.fileset.mappers;
+
+/*
+ * 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.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Implementation of RegexpPatternMapper that returns either the source file
+ * name or it processed by a matching Regular Expression and its replacement.
+ *
+ * <p>This is a RegexpPatternMapper for the copy and move tasks.</p>
+ */
+public class RegexpPatternMapper
+ implements FileNameMapper
+{
+ private Pattern fromPattern;
+ private String toReplaceExpression;
+
+ @Override
+ public void setFrom( String from )
+ {
+ this.fromPattern = Pattern.compile( from );
+ }
+
+ @Override
+ public void setTo( String to )
+ {
+ this.toReplaceExpression = to;
+ }
+
+ @Override
+ public String mapFileName( String sourceFileName )
+ {
+ Matcher matcher = this.fromPattern.matcher( sourceFileName );
+ if ( !matcher.find( ) )
+ {
+ return sourceFileName;
+ }
+
+ return matcher.replaceFirst( this.toReplaceExpression );
+ }
+}
=====================================
src/main/java/org/apache/maven/shared/model/fileset/mappers/UnPackageNameMapper.java
=====================================
@@ -30,13 +30,11 @@ import java.io.File;
* <mapper classname="org.apache.tools.ant.util.UnPackageNameMapper"
* from="${test.data.dir}/TEST-*Test.xml" to="*Test.java">
* </pre>
- *
- * @version $Id: UnPackageNameMapper.java 661727 2008-05-30 14:21:49Z bentmann $
*/
public class UnPackageNameMapper
extends GlobPatternMapper
{
- /** {@inheritDoc} */
+ @Override
protected String extractVariablePart( String name )
{
String var = name.substring( prefixLength, name.length() - postfixLength );
=====================================
src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java
=====================================
@@ -25,33 +25,28 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.shared.io.logging.DefaultMessageHolder;
-import org.apache.maven.shared.io.logging.MessageHolder;
-import org.apache.maven.shared.io.logging.MessageLevels;
-import org.apache.maven.shared.io.logging.MojoLogSink;
-import org.apache.maven.shared.io.logging.PlexusLoggerSink;
+import org.apache.commons.io.FileUtils;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.mappers.FileNameMapper;
import org.apache.maven.shared.model.fileset.mappers.MapperException;
import org.apache.maven.shared.model.fileset.mappers.MapperUtil;
-import org.apache.maven.shared.utils.io.DirectoryScanner;
-import org.apache.maven.shared.utils.io.FileUtils;
-import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static java.util.Objects.requireNonNull;
/**
* Provides operations for use with FileSet instances, such as retrieving the included/excluded files, deleting all
* matching entries, etc.
*
* @author jdcasey
- * @version $Id: FileSetManager.java 1721672 2015-12-25 13:18:36Z khmarbaise $
*/
public class FileSetManager
{
@@ -59,7 +54,7 @@ public class FileSetManager
private final boolean verbose;
- private MessageHolder messages;
+ private final Logger logger;
// ----------------------------------------------------------------------
// Constructors
@@ -68,77 +63,31 @@ public class FileSetManager
/**
* Create a new manager instance with the supplied log instance and flag for whether to output verbose messages.
*
- * @param log The mojo log instance
- * @param verbose Whether to output verbose messages
+ * @param logger the logger instance
+ * @param verbose whether to output verbose messages
*/
- public FileSetManager( Log log, boolean verbose )
+ public FileSetManager( Logger logger, boolean verbose )
{
- if ( verbose )
- {
- this.messages =
- new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
- }
- else
- {
- this.messages =
- new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
- }
-
+ this.logger = requireNonNull( logger );
this.verbose = verbose;
}
/**
* Create a new manager instance with the supplied log instance. Verbose flag is set to false.
*
- * @param log The mojo log instance
+ * @param logger The log instance
*/
- public FileSetManager( Log log )
+ public FileSetManager( Logger logger )
{
- this.messages =
- new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
- this.verbose = false;
+ this( logger, false );
}
/**
- * Create a new manager instance with the supplied log instance and flag for whether to output verbose messages.
- *
- * @param log The mojo log instance
- * @param verbose Whether to output verbose messages
- */
- public FileSetManager( Logger log, boolean verbose )
- {
- if ( verbose )
- {
- this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO,
- new PlexusLoggerSink( log ) );
- }
- else
- {
- this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO,
- new PlexusLoggerSink( log ) );
- }
-
- this.verbose = verbose;
- }
-
- /**
- * Create a new manager instance with the supplied log instance. Verbose flag is set to false.
- *
- * @param log The mojo log instance
- */
- public FileSetManager( Logger log )
- {
- this.messages =
- new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new PlexusLoggerSink( log ) );
- this.verbose = false;
- }
-
- /**
- * Create a new manager instance with an empty messages. Verbose flag is set to false.
+ * Create a new manager instance with an own logger. Verbose flag is set to false.
*/
public FileSetManager()
{
- this.verbose = false;
+ this( LoggerFactory.getLogger( FileSetManager.class ), false );
}
// ----------------------------------------------------------------------
@@ -155,14 +104,12 @@ public class FileSetManager
throws MapperException
{
String[] sourcePaths = getIncludedFiles( fileSet );
- Map<String, String> mappedPaths = new LinkedHashMap<String, String>();
+ Map<String, String> mappedPaths = new LinkedHashMap<>();
FileNameMapper fileMapper = MapperUtil.getFileNameMapper( fileSet.getMapper() );
- for ( int i = 0; i < sourcePaths.length; i++ )
+ for ( String sourcePath : sourcePaths )
{
- String sourcePath = sourcePaths[i];
-
String destPath;
if ( fileMapper != null )
{
@@ -276,18 +223,16 @@ public class FileSetManager
{
Set<String> deletablePaths = findDeletablePaths( fileSet );
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
String paths = String.valueOf( deletablePaths ).replace( ',', '\n' );
- messages.addDebugMessage( "Found deletable paths: " + paths ).flush();
+ logger.debug( "Found deletable paths: " + paths );
}
- List<String> warnMessages = new LinkedList<String>();
+ List<String> warnMessages = new LinkedList<>();
- for ( Iterator<String> it = deletablePaths.iterator(); it.hasNext(); )
+ for ( String path : deletablePaths )
{
- String path = it.next();
-
File file = new File( fileSet.getDirectory(), path );
if ( file.exists() )
@@ -296,18 +241,18 @@ public class FileSetManager
{
if ( fileSet.isFollowSymlinks() || !isSymlink( file ) )
{
- if ( verbose && messages != null )
+ if ( verbose )
{
- messages.addInfoMessage( "Deleting directory: " + file ).flush();
+ logger.info( "Deleting directory: " + file );
}
removeDir( file, fileSet.isFollowSymlinks(), throwsError, warnMessages );
}
else
{ // delete a symlink to a directory without follow
- if ( verbose && messages != null )
+ if ( verbose )
{
- messages.addInfoMessage( "Deleting symlink to directory: " + file ).flush();
+ logger.info( "Deleting symlink to directory: " + file );
}
if ( !file.delete() )
@@ -327,12 +272,12 @@ public class FileSetManager
}
else
{
- if ( verbose && messages != null )
+ if ( verbose )
{
- messages.addInfoMessage( "Deleting file: " + file ).flush();
+ logger.info( "Deleting file: " + file );
}
- if ( !delete( file ) )
+ if ( !FileUtils.deleteQuietly( file ) )
{
String message = "Failed to delete file " + file.getAbsolutePath() + ". Reason is unknown.";
if ( throwsError )
@@ -346,11 +291,11 @@ public class FileSetManager
}
}
- if ( messages != null && messages.isWarningEnabled() && !throwsError && ( warnMessages.size() > 0 ) )
+ if ( logger.isWarnEnabled() && !throwsError && ( warnMessages.size() > 0 ) )
{
- for ( Iterator<String> it = warnMessages.iterator(); it.hasNext(); )
+ for ( String warnMessage : warnMessages )
{
- messages.addWarningMessage( it.next() ).flush();
+ logger.warn( warnMessage );
}
}
}
@@ -362,7 +307,7 @@ public class FileSetManager
private boolean isSymlink( File file )
throws IOException
{
- File fileInCanonicalParent = null;
+ File fileInCanonicalParent;
File parentDir = file.getParentFile();
if ( parentDir == null )
{
@@ -372,11 +317,11 @@ public class FileSetManager
{
fileInCanonicalParent = new File( parentDir.getCanonicalPath(), file.getName() );
}
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Checking for symlink:\nFile's canonical path: "
+ logger.debug( "Checking for symlink:\nFile's canonical path: "
+ fileInCanonicalParent.getCanonicalPath() + "\nFile's absolute path with canonical parent: "
- + fileInCanonicalParent.getPath() ).flush();
+ + fileInCanonicalParent.getPath() );
}
return !fileInCanonicalParent.getCanonicalFile().equals( fileInCanonicalParent.getAbsoluteFile() );
}
@@ -391,38 +336,38 @@ public class FileSetManager
private Set<String> findDeletableDirectories( FileSet fileSet )
{
- if ( verbose && messages != null )
+ if ( verbose )
{
- messages.addInfoMessage( "Scanning for deletable directories." ).flush();
+ logger.info( "Scanning for deletable directories." );
}
DirectoryScanner scanner = scan( fileSet );
if ( scanner == null )
{
- return Collections.<String>emptySet();
+ return Collections.emptySet();
}
- Set<String> includes = new HashSet<String>( Arrays.asList( scanner.getIncludedDirectories() ) );
- List<String> excludes = new ArrayList<String>( Arrays.asList( scanner.getExcludedDirectories() ) );
- List<String> linksForDeletion = new ArrayList<String>();
+ Set<String> includes = new HashSet<>( Arrays.asList( scanner.getIncludedDirectories() ) );
+ List<String> excludes = new ArrayList<>( Arrays.asList( scanner.getExcludedDirectories() ) );
+ List<String> linksForDeletion = new ArrayList<>();
if ( !fileSet.isFollowSymlinks() )
{
- if ( verbose && messages != null )
+ if ( verbose )
{
- messages.addInfoMessage( "Adding symbolic link dirs which were previously excluded"
- + " to the list being deleted." ).flush();
+ logger.info( "Adding symbolic link dirs which were previously excluded"
+ + " to the list being deleted." );
}
// we need to see which entries were only excluded because they're symlinks...
scanner.setFollowSymlinks( true );
scanner.scan();
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Originally marked for delete: " + includes ).flush();
- messages.addDebugMessage( "Marked for preserve (with followSymlinks == false): " + excludes ).flush();
+ logger.debug( "Originally marked for delete: " + includes );
+ logger.debug( "Marked for preserve (with followSymlinks == false): " + excludes );
}
List<String> includedDirsAndSymlinks = Arrays.asList( scanner.getIncludedDirectories() );
@@ -430,10 +375,10 @@ public class FileSetManager
linksForDeletion.addAll( excludes );
linksForDeletion.retainAll( includedDirsAndSymlinks );
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Symlinks marked for deletion (originally mismarked): "
- + linksForDeletion ).flush();
+ logger.debug( "Symlinks marked for deletion (originally mismarked): "
+ + linksForDeletion );
}
excludes.removeAll( includedDirsAndSymlinks );
@@ -448,9 +393,9 @@ public class FileSetManager
private Set<String> findDeletableFiles( FileSet fileSet, Set<String> deletableDirectories )
{
- if ( verbose && messages != null )
+ if ( verbose )
{
- messages.addInfoMessage( "Re-scanning for deletable files." ).flush();
+ logger.info( "Re-scanning for deletable files." );
}
DirectoryScanner scanner = scan( fileSet );
@@ -460,27 +405,26 @@ public class FileSetManager
return deletableDirectories;
}
- Set<String> includes = deletableDirectories;
- includes.addAll( Arrays.asList( scanner.getIncludedFiles() ) );
- List<String> excludes = new ArrayList<String>( Arrays.asList( scanner.getExcludedFiles() ) );
- List<String> linksForDeletion = new ArrayList<String>();
+ deletableDirectories.addAll( Arrays.asList( scanner.getIncludedFiles() ) );
+ List<String> excludes = new ArrayList<>( Arrays.asList( scanner.getExcludedFiles() ) );
+ List<String> linksForDeletion = new ArrayList<>();
if ( !fileSet.isFollowSymlinks() )
{
- if ( verbose && messages != null )
+ if ( verbose )
{
- messages.addInfoMessage( "Adding symbolic link files which were previously excluded "
- + "to the list being deleted." ).flush();
+ logger.info( "Adding symbolic link files which were previously excluded "
+ + "to the list being deleted." );
}
// we need to see which entries were only excluded because they're symlinks...
scanner.setFollowSymlinks( true );
scanner.scan();
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Originally marked for delete: " + includes ).flush();
- messages.addDebugMessage( "Marked for preserve (with followSymlinks == false): " + excludes ).flush();
+ logger.debug( "Originally marked for delete: " + deletableDirectories );
+ logger.debug( "Marked for preserve (with followSymlinks == false): " + excludes );
}
List<String> includedFilesAndSymlinks = Arrays.asList( scanner.getIncludedFiles() );
@@ -488,20 +432,20 @@ public class FileSetManager
linksForDeletion.addAll( excludes );
linksForDeletion.retainAll( includedFilesAndSymlinks );
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Symlinks marked for deletion (originally mismarked): "
- + linksForDeletion ).flush();
+ logger.debug( "Symlinks marked for deletion (originally mismarked): "
+ + linksForDeletion );
}
excludes.removeAll( includedFilesAndSymlinks );
}
- excludeParentDirectoriesOfExcludedPaths( excludes, includes );
+ excludeParentDirectoriesOfExcludedPaths( excludes, deletableDirectories );
- includes.addAll( linksForDeletion );
+ deletableDirectories.addAll( linksForDeletion );
- return includes;
+ return deletableDirectories;
}
/**
@@ -515,25 +459,23 @@ public class FileSetManager
*/
private void excludeParentDirectoriesOfExcludedPaths( List<String> excludedPaths, Set<String> deletablePaths )
{
- for ( Iterator<String> it = excludedPaths.iterator(); it.hasNext(); )
+ for ( String path : excludedPaths )
{
- String path = it.next();
-
String parentPath = new File( path ).getParent();
while ( parentPath != null )
{
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Verifying path " + parentPath
- + " is not present; contains file which is excluded." ).flush();
+ logger.debug(
+ "Verifying path " + parentPath + " is not present; contains file which is excluded." );
}
boolean removed = deletablePaths.remove( parentPath );
- if ( removed && messages != null && messages.isDebugEnabled() )
+ if ( removed && logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Path " + parentPath + " was removed from delete list." ).flush();
+ logger.debug( "Path " + parentPath + " was removed from delete list." );
}
parentPath = new File( parentPath ).getParent();
@@ -542,17 +484,17 @@ public class FileSetManager
if ( !excludedPaths.isEmpty() )
{
- if ( messages != null && messages.isDebugEnabled() )
+ if ( logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Verifying path " + "."
- + " is not present; contains file which is excluded." ).flush();
+ logger.debug( "Verifying path " + "."
+ + " is not present; contains file which is excluded." );
}
boolean removed = deletablePaths.remove( "" );
- if ( removed && messages != null && messages.isDebugEnabled() )
+ if ( removed && logger.isDebugEnabled() )
{
- messages.addDebugMessage( "Path " + "." + " was removed from delete list." ).flush();
+ logger.debug( "Path " + "." + " was removed from delete list." );
}
}
}
@@ -575,9 +517,8 @@ public class FileSetManager
list = new String[0];
}
- for ( int i = 0; i < list.length; i++ )
+ for ( String s : list )
{
- String s = list[i];
File f = new File( dir, s );
if ( f.isDirectory() && ( followSymlinks || !isSymlink( f ) ) )
{
@@ -585,7 +526,7 @@ public class FileSetManager
}
else
{
- if ( !delete( f ) )
+ if ( !FileUtils.deleteQuietly( f ) )
{
String message = "Unable to delete file " + f.getAbsolutePath();
if ( throwsError )
@@ -601,7 +542,7 @@ public class FileSetManager
}
}
- if ( !delete( dir ) )
+ if ( !FileUtils.deleteQuietly( dir ) )
{
String message = "Unable to delete directory " + dir.getAbsolutePath();
if ( throwsError )
@@ -616,25 +557,6 @@ public class FileSetManager
}
}
- /**
- * Delete a file
- *
- * @param f a file
- */
- private boolean delete( File f )
- {
- try
- {
- FileUtils.forceDelete( f );
- }
- catch ( IOException e )
- {
- return false;
- }
-
- return true;
- }
-
private DirectoryScanner scan( FileSet fileSet )
{
File basedir = new File( fileSet.getDirectory() );
=====================================
src/main/mdo/fileset.mdo
=====================================
@@ -19,8 +19,8 @@
under the License.
-->
-<model xmlns="http://modello.codehaus.org/MODELLO/1.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.4.0 http://modello.codehaus.org/xsd/modello-1.4.0.xsd">
+<model xmlns="https://codehaus-plexus.github.io/MODELLO/1.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="https://codehaus-plexus.github.io/MODELLO/1.4.0 https://codehaus-plexus.github.io/modello/xsd/modello-1.4.0.xsd">
<id>fileset</id>
<name>FileSet</name>
<description>
=====================================
src/site/site.xml
=====================================
@@ -26,7 +26,7 @@ under the License.
<item name="JavaDocs" href="apidocs/index.html"/>
<item name="Source Xref" href="xref/index.html"/>
<!--item name="FAQ" href="faq.html"/-->
- <!-- According to http://jira.codehaus.org/browse/MNGSITE-152 -->
+ <!-- According to https://issues.apache.org/jira/browse/MNGSITE-152 -->
<item name="License" href="http://www.apache.org/licenses/"/>
<item name="Download" href="download.html"/>
</menu>
=====================================
src/site/xdoc/download.xml.vm
=====================================
@@ -34,7 +34,7 @@ under the License.
<p>In order to guard against corrupted downloads/installations, it is highly recommended to
<a href="http://www.apache.org/dev/release-signing#verifying-signature">verify the signature</a>
- of the release bundles against the public <a href="http://www.apache.org/dist/maven/KEYS">KEYS</a> used by the Apache Maven
+ of the release bundles against the public <a href="https://www.apache.org/dist/maven/KEYS">KEYS</a> used by the Apache Maven
developers.</p>
<p>${project.name} is distributed under the <a href="http://www.apache.org/licenses/">Apache License, version 2.0</a>.</p>
@@ -108,8 +108,8 @@ under the License.
<tr>
<td>${project.name} ${project.version} (Source zip)</td>
<td><a href="[preferred]maven/shared/${project.artifactId}-${project.version}-source-release.zip">maven/shared/${project.artifactId}-${project.version}-source-release.zip</a></td>
- <td><a href="http://www.apache.org/dist/maven/shared/${project.artifactId}-${project.version}-source-release.zip.md5">maven/shared/${project.artifactId}-${project.version}-source-release.zip.md5</a></td>
- <td><a href="http://www.apache.org/dist/maven/shared/${project.artifactId}-${project.version}-source-release.zip.asc">maven/shared/${project.artifactId}-${project.version}-source-release.zip.asc</a></td>
+ <td><a href="https://www.apache.org/dist/maven/shared/${project.artifactId}-${project.version}-source-release.zip.sha512">maven/shared/${project.artifactId}-${project.version}-source-release.zip.sha512</a></td>
+ <td><a href="https://www.apache.org/dist/maven/shared/${project.artifactId}-${project.version}-source-release.zip.asc">maven/shared/${project.artifactId}-${project.version}-source-release.zip.asc</a></td>
</tr>
</tbody>
</table>
=====================================
src/test/java/org/apache/maven/shared/model/fileset/mappers/MapperUtilTest.java
=====================================
@@ -29,12 +29,9 @@ import org.junit.Test;
/**
* A test-case for the MapperUtil.
- *
- * @version $Id: MapperUtilTest.java 1716893 2015-11-27 16:09:51Z khmarbaise $
*/
public class MapperUtilTest
{
-
@Test
public void getFileNameMapperShouldReturnNull()
throws MapperException
@@ -69,16 +66,16 @@ public class MapperUtilTest
@Test
public void testGetFileNameMapper() throws MapperException
{
- Mapper mapper = null;
try
{
- assertNull( MapperUtil.getFileNameMapper( mapper ) );
+ assertNull( MapperUtil.getFileNameMapper( null ) );
}
catch ( MapperException e )
{
fail( "Unexpected exception " + e );
}
- mapper = new Mapper();
+
+ Mapper mapper = new Mapper();
try
{
// default to identity mapper.
=====================================
src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
=====================================
@@ -24,43 +24,39 @@ import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
+import org.apache.commons.io.FileUtils;
import org.apache.maven.shared.model.fileset.FileSet;
-import org.apache.maven.shared.utils.cli.CommandLineException;
-import org.apache.maven.shared.utils.cli.Commandline;
-import org.apache.maven.shared.utils.io.FileUtils;
-import junit.framework.TestCase;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.junit.After;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
/**
* Test the FileSet
- *
- * @version $Id: FileSetUtilsTest.java 1716893 2015-11-27 16:09:51Z khmarbaise $
*/
public class FileSetUtilsTest
- extends TestCase
{
- private Set<File> testDirectories = new HashSet<File>();
+ private final Set<File> testDirectories = new HashSet<>();
- private Set<File> linkFiles = new HashSet<File>();
+ private final Set<File> linkFiles = new HashSet<>();
/** {@inheritDoc} */
+ @After
public void tearDown()
throws IOException
{
- for ( Iterator<File> it = linkFiles.iterator(); it.hasNext(); )
+ for ( File linkFile : linkFiles )
{
- File linkFile = it.next();
-
linkFile.delete();
}
- for ( Iterator<File> it = testDirectories.iterator(); it.hasNext(); )
+ for ( File dir : testDirectories )
{
- File dir = it.next();
-
FileUtils.deleteDirectory( dir );
}
}
@@ -68,6 +64,7 @@ public class FileSetUtilsTest
/**
* @throws IOException if any
*/
+ @Test
public void testGetIncludedFiles()
throws IOException
{
@@ -87,10 +84,10 @@ public class FileSetUtilsTest
/**
* @throws IOException if any
* @throws InterruptedException if any
- * @throws org.apache.maven.shared.utils.cli.CommandLineException if any
*/
+ @Test
public void testIncludesDontFollowSymlinks()
- throws IOException, InterruptedException, CommandLineException
+ throws IOException, InterruptedException, CommandLineException
{
File directory = setupTestDirectory( "testIncludesDontFollowSymlinks" );
File subdir = new File( directory, directory.getName() );
@@ -119,6 +116,7 @@ public class FileSetUtilsTest
* @throws InterruptedException if any
* @throws CommandLineException if any
*/
+ @Test
public void testDeleteDontFollowSymlinks()
throws IOException, InterruptedException, CommandLineException
{
@@ -148,6 +146,7 @@ public class FileSetUtilsTest
/**
* @throws IOException if any
*/
+ @Test
public void testDelete()
throws IOException
{
@@ -169,6 +168,7 @@ public class FileSetUtilsTest
/**
* @throws Exception if any
*/
+ @Test
public void testDeleteDanglingSymlink()
throws Exception
{
@@ -197,6 +197,7 @@ public class FileSetUtilsTest
/**
* @throws Exception if any
*/
+ @Test
public void testDeleteExcludeParentOfExcludedFile()
throws Exception
{
@@ -217,6 +218,7 @@ public class FileSetUtilsTest
/**
* @throws Exception if any
*/
+ @Test
public void testDeleteExcludeParentOfExcludedDir()
throws Exception
{
@@ -237,6 +239,7 @@ public class FileSetUtilsTest
/**
* @throws Exception if any
*/
+ @Test
public void testDeleteExcludeFollowSymlinks()
throws Exception
{
@@ -259,6 +262,7 @@ public class FileSetUtilsTest
/**
* @throws Exception if any
*/
+ @Test
public void testDeleteExcludeDontFollowSymlinks()
throws Exception
{
@@ -281,6 +285,7 @@ public class FileSetUtilsTest
/**
* @throws Exception if any
*/
+ @Test
public void testDeleteDontFollowSymlinksButDeleteThem()
throws Exception
{
@@ -316,7 +321,8 @@ public class FileSetUtilsTest
* @throws CommandLineException
*/
private boolean createSymlink( File target, File link )
- throws InterruptedException, CommandLineException
+ throws InterruptedException, CommandLineException
+
{
if ( link.exists() )
{
@@ -336,11 +342,6 @@ public class FileSetUtilsTest
return result == 0;
}
- /**
- * @param directoryName
- * @return
- * @throws IOException
- */
private File setupTestDirectory( String directoryName )
throws IOException
{
@@ -357,12 +358,12 @@ public class FileSetUtilsTest
String testBase = System.getProperty( "testBase", "target/test-directories" );
File testDir = new File( basedir, testBase + "/" + directoryName );
- testDir.mkdirs();
-
- FileUtils.copyDirectoryStructure( sourceDir, testDir );
-
- testDirectories.add( testDir );
-
- return testDir;
+ if ( testDir.mkdirs() ) {
+ FileUtils.copyDirectory( sourceDir, testDir );
+ testDirectories.add( testDir );
+ return testDir;
+ } else {
+ throw new IOException( "Could not create test directory " + testDir );
+ }
}
}
View it on GitLab: https://salsa.debian.org/java-team/maven-file-management/-/commit/3dec84a536341c46e07223456ad5a57704c26c49
--
View it on GitLab: https://salsa.debian.org/java-team/maven-file-management/-/commit/3dec84a536341c46e07223456ad5a57704c26c49
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261105/38bef77e/attachment.htm>
More information about the pkg-java-commits
mailing list