diff --git a/src/it/projects/copy-dependencies-with-conflict/verify.groovy b/src/it/projects/copy-dependencies-with-conflict/verify.groovy
index b66deb089..471c39127 100644
--- a/src/it/projects/copy-dependencies-with-conflict/verify.groovy
+++ b/src/it/projects/copy-dependencies-with-conflict/verify.groovy
@@ -22,10 +22,10 @@ assert file.exists()
String buildLog = file.getText( "UTF-8" )
assert buildLog.contains( '[WARNING] Overwriting ' )
-assert buildLog.contains( '[DEBUG] Copying artifact \'org.jdom:jdom:jar:1.1.3\'' )
-assert buildLog.contains( '[DEBUG] Copying artifact \'org.jdom:jdom:pom:1.1.3\'' )
-assert buildLog.contains( '[DEBUG] Copying artifact \'org.jdom:jdom:jar:1.1.3\'' )
-assert buildLog.contains( '[DEBUG] Copying artifact \'org.lucee:jdom:jar:1.1.3\'' )
+assert buildLog.contains( '[INFO] Copying artifact \'org.jdom:jdom:jar:1.1.3\'' )
+assert buildLog.contains( '[INFO] Copying artifact \'org.jdom:jdom:pom:1.1.3\'' )
+assert buildLog.contains( '[INFO] Copying artifact \'org.jdom:jdom:jar:1.1.3\'' )
+assert buildLog.contains( '[INFO] Copying artifact \'org.lucee:jdom:jar:1.1.3\'' )
assert buildLog.contains( '[WARNING] Multiple files with the name jdom-1.1.3.jar in the dependency tree.' )
return true
diff --git a/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java b/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java
index 5045f607c..5209fdd67 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java
@@ -25,9 +25,7 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.SystemStreamLog;
import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.dependency.utils.DependencySilentLog;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
@@ -61,16 +59,6 @@ public abstract class AbstractDependencyMojo extends AbstractMojo {
*/
protected final MavenSession session;
- /**
- * If the plugin should be silent.
- *
- * @since 2.0
- * @deprecated to be removed in 4.0; use -q command line option instead
- */
- @Deprecated
- @Parameter(property = "silent", defaultValue = "false")
- private boolean silent;
-
/**
* Skip plugin execution completely.
*
@@ -172,27 +160,4 @@ public boolean isSkip() {
public void setSkip(boolean skip) {
this.skip = skip;
}
-
- /**
- * @return {@link #silent}
- * @deprecated to be removed in 4.0
- */
- @Deprecated
- protected final boolean isSilent() {
- return silent;
- }
-
- /**
- * @param silent {@link #silent}
- * @deprecated to be removed in 4.0; no API replacement, use -q command line option instead
- */
- @Deprecated
- public void setSilent(boolean silent) {
- this.silent = silent;
- if (silent) {
- setLog(new DependencySilentLog());
- } else if (getLog() instanceof DependencySilentLog) {
- setLog(new SystemStreamLog());
- }
- }
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
index 88914298e..5cc2da426 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
@@ -92,6 +92,15 @@ public abstract class AbstractFromConfigurationMojo extends AbstractDependencyMo
@Parameter(property = "mdep.overIfNewer", defaultValue = "true")
private boolean overIfNewer;
+ /**
+ * If the plugin should be more silent with logging.
+ *
+ * Use {@code -q} command line option if you want to suppress all output.
+ * @since 2.0
+ */
+ @Parameter(property = "silent", defaultValue = "false")
+ private boolean silent;
+
/**
* Overwrite if newer.
*
@@ -386,6 +395,13 @@ public void setLocalRepositoryDirectory(File localRepositoryDirectory) {
this.localRepositoryDirectory = localRepositoryDirectory;
}
+ /**
+ * @return {@link #silent}
+ */
+ protected final boolean isSilent() {
+ return silent;
+ }
+
/**
* @param artifact the artifact
* @throws MojoFailureException in case of an error
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java
index dab686a50..b95f690ce 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java
@@ -128,7 +128,7 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {
*
* @param artifactItem containing the information about the artifact to copy
* @throws MojoExecutionException with a message if an error occurs
- * @see CopyUtil#copyArtifactFile(Artifact, File)
+ * @see CopyUtil#copyArtifactFile(Artifact, File, boolean)
*/
protected void copyArtifact(ArtifactItem artifactItem) throws MojoExecutionException {
File destFile = new File(artifactItem.getOutputDirectory(), artifactItem.getDestFileName());
@@ -136,7 +136,7 @@ protected void copyArtifact(ArtifactItem artifactItem) throws MojoExecutionExcep
getLog().warn("Overwriting " + destFile);
}
try {
- copyUtil.copyArtifactFile(artifactItem.getArtifact(), destFile);
+ copyUtil.copyArtifactFile(artifactItem.getArtifact(), destFile, isSilent());
} catch (IOException e) {
throw new MojoExecutionException(
"Failed to copy artifact '" + artifactItem.getArtifact() + "' ("
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
index e4854371c..497a2b5b3 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
@@ -162,7 +162,7 @@ private void unpackArtifact(ArtifactItem artifactItem) throws MojoExecutionExcep
artifactItem.getEncoding(),
ignorePermissions,
artifactItem.getFileMappers(),
- getLog());
+ isSilent());
handler.setMarker();
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java
index 19038fac4..9e0e7c4cc 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java
@@ -112,6 +112,15 @@ public abstract class AbstractFromDependenciesMojo extends AbstractDependencyFil
@Parameter(property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false")
protected boolean failOnMissingClassifierArtifact;
+ /**
+ * If the plugin should be more silent with logging.
+ *
+ * Use {@code -q} command line option if you want to suppress all output.
+ * @since 2.0
+ */
+ @Parameter(property = "silent", defaultValue = "false")
+ private boolean silent;
+
protected AbstractFromDependenciesMojo(
MavenSession session,
BuildContext buildContext,
@@ -233,4 +242,11 @@ public boolean isUseRepositoryLayout() {
public void setUseRepositoryLayout(boolean useRepositoryLayout) {
this.useRepositoryLayout = useRepositoryLayout;
}
+
+ /**
+ * @return {@link #silent}
+ */
+ protected final boolean isSilent() {
+ return silent;
+ }
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
index ece098283..9ad4d3a91 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
@@ -237,7 +237,7 @@ protected void copyArtifact(
* @param useBaseVersion specifies if the baseVersion of the artifact should be used instead of the version
* @param removeClassifier specifies if the classifier should be removed from the file name when copying
* @throws MojoExecutionException with a message if an error occurs
- * @see CopyUtil#copyArtifactFile(Artifact, File)
+ * @see CopyUtil#copyArtifactFile(Artifact, File, boolean)
* @see DependencyUtil#getFormattedOutputDirectory(boolean, boolean, boolean, boolean, boolean, boolean, File, Artifact)
*/
private static final String SIGNATURE_EXTENSION = ".asc";
@@ -267,7 +267,7 @@ protected void copyArtifact(
getLog().warn("Overwriting " + destFile);
}
try {
- copyUtil.copyArtifactFile(artifact, destFile);
+ copyUtil.copyArtifactFile(artifact, destFile, isSilent());
// Copy the signature file if the copySignatures flag is true
if (copySignatures) {
@@ -307,7 +307,7 @@ private void copySignatureFile(Artifact artifact, File destDir, String destFileN
if (signatureFile != null && signatureFile.exists()) {
File signatureDestFile = new File(destDir, destFileName + SIGNATURE_EXTENSION);
try {
- copyUtil.copyFile(signatureFile, signatureDestFile);
+ copyUtil.copyFile(signatureFile, signatureDestFile, isSilent());
} catch (IOException e) {
getLog().warn("Failed to copy signature file: " + signatureFile, e);
}
@@ -354,7 +354,7 @@ public void copyPoms(File destDir, Set artifacts, boolean removeVersio
pomArtifact, removeVersion, prependGroupId, useBaseVersion, removeClassifier));
if (!pomDestFile.exists()) {
try {
- copyUtil.copyArtifactFile(pomArtifact, pomDestFile);
+ copyUtil.copyArtifactFile(pomArtifact, pomDestFile, isSilent());
} catch (IOException e) {
throw new MojoExecutionException(
"Failed to copy artifact '" + pomArtifact + "' (" + pomArtifact.getFile() + ") to "
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
index 707178373..eabb97ffe 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
@@ -146,7 +146,7 @@ protected void doExecute() throws MojoExecutionException {
getEncoding(),
ignorePermissions,
getFileMappers(),
- getLog());
+ isSilent());
DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler(artifact, this.markersDirectory);
handler.setMarker();
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
index d6adeefb5..8ac552d2e 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
@@ -35,6 +35,7 @@
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.dependency.utils.DependencyUtil;
import org.apache.maven.plugins.dependency.utils.ResolverUtil;
import org.apache.maven.project.MavenProject;
@@ -64,6 +65,15 @@ public class GoOfflineMojo extends AbstractResolveMojo {
private final DependencyResolver dependencyResolver;
+ /**
+ * If the plugin should be more silent with logging.
+ *
+ * Use {@code -q} command line option if you want to suppress all output.
+ * @since 2.0
+ */
+ @Parameter(property = "silent", defaultValue = "false")
+ private boolean silent;
+
@Inject
// CHECKSTYLE_OFF: ParameterNumber
public GoOfflineMojo(
@@ -93,7 +103,7 @@ protected void doExecute() throws MojoExecutionException {
final Set dependencies = resolveDependencyArtifacts();
- if (!isSilent()) {
+ if (!silent) {
for (Artifact artifact : plugins) {
this.getLog().info("Resolved plugin: " + DependencyUtil.getFormattedFileName(artifact, false));
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java
index d18fbd992..01cbba4a3 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java
@@ -55,11 +55,13 @@ public CopyUtil(BuildContext buildContext) {
*
* @param sourceArtifact the artifact (file) to copy
* @param destination file name of destination file
+ * @param silent if true, don't show information about copied files
* @throws IOException if copy has failed
* @throws MojoExecutionException if artifact file is a directory (which has not been packaged yet)
* @since 3.7.0
*/
- public void copyArtifactFile(Artifact sourceArtifact, File destination) throws IOException, MojoExecutionException {
+ public void copyArtifactFile(Artifact sourceArtifact, File destination, boolean silent)
+ throws IOException, MojoExecutionException {
File source = sourceArtifact.getFile();
if (source.isDirectory()) {
// usual case is a future jar packaging, but there are special cases: classifier and other packaging
@@ -67,7 +69,12 @@ public void copyArtifactFile(Artifact sourceArtifact, File destination) throws I
+ "' has not been packaged yet (is a directory). When used on reactor artifact, "
+ "copy should be executed after packaging: see MDEP-187.");
}
- logger.debug("Copying artifact '{}' ({}) to {}", sourceArtifact.getId(), sourceArtifact.getFile(), destination);
+
+ if (!silent || logger.isDebugEnabled()) {
+ logger.info(
+ "Copying artifact '{}' ({}) to {}", sourceArtifact.getId(), sourceArtifact.getFile(), destination);
+ }
+
FileUtils.copyFile(source, destination);
buildContext.refresh(destination);
}
@@ -77,11 +84,14 @@ public void copyArtifactFile(Artifact sourceArtifact, File destination) throws I
*
* @param source the source file to copy
* @param destination the destination file
+ * @param silent if true, don't show information about copied files
* @throws IOException if copy has failed
* @since 3.2.0
*/
- public void copyFile(File source, File destination) throws IOException {
- logger.debug("Copying file '{}' to {}", source, destination);
+ public void copyFile(File source, File destination, boolean silent) throws IOException {
+ if (!silent || logger.isDebugEnabled()) {
+ logger.info("Copying file '{}' to {}", source, destination);
+ }
FileUtils.copyFile(source, destination);
buildContext.refresh(destination);
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencySilentLog.java b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencySilentLog.java
deleted file mode 100644
index 7e2106a2f..000000000
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencySilentLog.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.plugins.dependency.utils;
-
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * This logger implements both types of logs currently in use and turns off logs.
- *
- * @author Brian Fox
- */
-public class DependencySilentLog implements Log {
- /**
- * @return false
- * @see org.apache.maven.plugin.logging.Log#isDebugEnabled()
- */
- @Override
- public boolean isDebugEnabled() {
- return false;
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence)
- */
- @Override
- public void debug(CharSequence content) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void debug(CharSequence content, Throwable error) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#debug(java.lang.Throwable)
- */
- @Override
- public void debug(Throwable error) {
- // nop
- }
-
- /**
- * @return false
- * @see org.apache.maven.plugin.logging.Log#isInfoEnabled()
- */
- @Override
- public boolean isInfoEnabled() {
- return false;
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence)
- */
- @Override
- public void info(CharSequence content) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void info(CharSequence content, Throwable error) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#info(java.lang.Throwable)
- */
- @Override
- public void info(Throwable error) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#isWarnEnabled()
- */
- @Override
- public boolean isWarnEnabled() {
- // nop
- return false;
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence)
- */
- @Override
- public void warn(CharSequence content) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void warn(CharSequence content, Throwable error) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#warn(java.lang.Throwable)
- */
- @Override
- public void warn(Throwable error) {
- // nop
- }
-
- /**
- * @return false
- * @see org.apache.maven.plugin.logging.Log#isErrorEnabled()
- */
- @Override
- public boolean isErrorEnabled() {
- return false;
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence)
- */
- @Override
- public void error(CharSequence content) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence, java.lang.Throwable)
- */
- @Override
- public void error(CharSequence content, Throwable error) {
- // nop
- }
-
- /**
- * By default, do nothing.
- *
- * @see org.apache.maven.plugin.logging.Log#error(java.lang.Throwable)
- */
- @Override
- public void error(Throwable error) {
- // nop
- }
-}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
index 0d6cd7164..3e5c40585 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java
@@ -25,7 +25,6 @@
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.UnArchiver;
import org.codehaus.plexus.archiver.manager.ArchiverManager;
@@ -33,6 +32,8 @@
import org.codehaus.plexus.archiver.zip.ZipUnArchiver;
import org.codehaus.plexus.components.io.filemappers.FileMapper;
import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.sonatype.plexus.build.incremental.BuildContext;
/**
@@ -43,6 +44,7 @@
@Singleton
public class UnpackUtil {
+ private final Logger logger = LoggerFactory.getLogger(UnpackUtil.class);
/**
* To look up Archiver/UnArchiver implementations.
*/
@@ -76,8 +78,10 @@ public UnpackUtil(ArchiverManager archiverManager, BuildContext buildContext) {
* @param fileMappers {@link FileMapper}s to be used for rewriting each target path, or {@code null} if no
* rewriting
* shall happen
- * @param logger a Mojo logger
+ * @param silent if true, don't show information about unpacked files
* @throws MojoExecutionException in case of an error
+ * shall happen.
+ * @throws MojoExecutionException in case of an error.
*/
public void unpack(
File file,
@@ -88,10 +92,10 @@ public void unpack(
String encoding,
boolean ignorePermissions,
FileMapper[] fileMappers,
- Log logger)
+ boolean silent)
throws MojoExecutionException {
try {
- logUnpack(logger, file, location, includes, excludes);
+ logUnpack(silent, file, location, includes, excludes);
location.mkdirs();
if (!location.exists()) {
@@ -117,7 +121,7 @@ public void unpack(
if (encoding != null && unArchiver instanceof ZipUnArchiver) {
((ZipUnArchiver) unArchiver).setEncoding(encoding);
- logger.info("Unpacks '" + type + "' with encoding '" + encoding + "'.");
+ logger.debug("Unpacks '" + type + "' with encoding '" + encoding + "'.");
}
unArchiver.setIgnorePermissions(ignorePermissions);
@@ -155,8 +159,8 @@ public void unpack(
buildContext.refresh(location);
}
- private void logUnpack(Log logger, File file, File location, String includes, String excludes) {
- if (logger.isInfoEnabled()) {
+ private void logUnpack(boolean silent, File file, File location, String includes, String excludes) {
+ if (silent && !logger.isDebugEnabled()) {
return;
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java b/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
index 7e1006770..d12c3d1bd 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
@@ -104,7 +104,7 @@ protected void tearDown() throws Exception {
}
protected void copyArtifactFile(Artifact sourceArtifact, File destFile) throws MojoExecutionException, IOException {
- new CopyUtil(new DefaultBuildContext()).copyArtifactFile(sourceArtifact, destFile);
+ new CopyUtil(new DefaultBuildContext()).copyArtifactFile(sourceArtifact, destFile, true);
}
protected void installLocalRepository(LegacySupport legacySupport) throws ComponentLookupException {
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java b/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
index f93ee2cef..a3f3b78ec 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
@@ -24,9 +24,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugins.dependency.resolvers.CollectDependenciesMojo;
-import org.apache.maven.plugins.dependency.resolvers.ResolveDependenciesMojo;
import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
-import org.apache.maven.plugins.dependency.utils.DependencySilentLog;
import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
import org.apache.maven.project.MavenProject;
@@ -107,17 +105,4 @@ public void testCollectTestEnvironmentExcludeTransitive() throws Exception {
assertNotNull(results);
assertEquals(directArtifacts.size(), results.getResolvedDependencies().size());
}
-
- public void testSilent() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/resolve-test/plugin-config.xml");
- ResolveDependenciesMojo mojo = (ResolveDependenciesMojo) lookupMojo("resolve", testPom);
-
- assertFalse(mojo.getLog() instanceof DependencySilentLog);
-
- mojo.setSilent(true);
- assertTrue(mojo.getLog() instanceof DependencySilentLog);
-
- mojo.setSilent(false);
- assertFalse(mojo.getLog() instanceof DependencySilentLog);
- } // TODO: Test skipping artifacts.
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
index 2a5d2d843..4640f961b 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
@@ -25,7 +25,6 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
-import org.apache.maven.plugins.dependency.utils.DependencySilentLog;
import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
import org.apache.maven.project.MavenProject;
@@ -85,17 +84,4 @@ public void testResolveTestEnvironment() throws Exception {
assertNotNull(results);
assertEquals(directArtifacts.size(), results.getResolvedDependencies().size());
}
-
- public void testSilent() throws Exception {
- File testPom = new File(getBasedir(), "target/test-classes/unit/resolve-test/plugin-config.xml");
- ResolveDependenciesMojo mojo = (ResolveDependenciesMojo) lookupMojo("resolve", testPom);
-
- assertFalse(mojo.getLog() instanceof DependencySilentLog);
-
- mojo.setSilent(true);
- assertTrue(mojo.getLog() instanceof DependencySilentLog);
-
- mojo.setSilent(false);
- assertFalse(mojo.getLog() instanceof DependencySilentLog);
- } // TODO: Test skipping artifacts.
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/TestSilentLog.java b/src/test/java/org/apache/maven/plugins/dependency/utils/TestSilentLog.java
deleted file mode 100644
index 025e42338..000000000
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/TestSilentLog.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.plugins.dependency.utils;
-
-import org.apache.maven.plugin.logging.Log;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestSilentLog {
-
- @Test
- public void testLog() {
- Log log = new DependencySilentLog();
- String text = "Text";
- Throwable e = new RuntimeException();
- log.debug(text);
- log.debug(text, e);
- log.debug(e);
- log.info(text);
- log.info(text, e);
- log.info(e);
- log.warn(text);
- log.warn(text, e);
- log.warn(e);
- log.error(text);
- log.error(text, e);
- log.error(e);
- Assert.assertFalse(log.isDebugEnabled());
- Assert.assertFalse(log.isErrorEnabled());
- Assert.assertFalse(log.isWarnEnabled());
- Assert.assertFalse(log.isInfoEnabled());
- }
-}