[jira] [Commented] (MDEP-923) Code cleanups

2024-06-07 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17853279#comment-17853279
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski merged PR #407:
URL: https://github.com/apache/maven-dependency-plugin/pull/407




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-06-06 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17853014#comment-17853014
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on PR #407:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/407#issuecomment-2153996246

   > I do not really understand this PR. Those two blocks are only used in one 
class, not the other subclasses?
   
   Exactly it is used in one place, so we not need it for other classes.
   It will be easier for future refactor. 




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-06-06 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17852939#comment-17852939
 ] 

ASF GitHub Bot commented on MDEP-923:
-

michael-o commented on PR #407:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/407#issuecomment-2153342860

   I do not really understand this PR. Those two blocks are only used in one 
class, not the other subclasses?




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-06-06 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17852937#comment-17852937
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski opened a new pull request, #407:
URL: https://github.com/apache/maven-dependency-plugin/pull/407

   next code cleanups ...
   
   in next step we cen remove `AbstractResolveMojo`




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-27 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17849787#comment-17849787
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski merged PR #389:
URL: https://github.com/apache/maven-dependency-plugin/pull/389




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17849049#comment-17849049
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1612080238


##
src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java:
##
@@ -80,7 +80,7 @@ public void assertNoMarkerFile(Artifact artifact) throws 
MojoExecutionException
 assertFalse(handle.isMarkerSet());
 }
 
-public void testCopyFile() throws MojoExecutionException, IOException {
+public void testCopyFile() throws Exception {

Review Comment:
   ok, one exception is new in 3.7.0 but one is old from copied  class - so 
should I discovered versions for original class or add since now





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17849031#comment-17849031
 ] 

ASF GitHub Bot commented on MDEP-923:
-

elharo commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1612013270


##
src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java:
##
@@ -80,7 +80,7 @@ public void assertNoMarkerFile(Artifact artifact) throws 
MojoExecutionException
 assertFalse(handle.isMarkerSet());
 }
 
-public void testCopyFile() throws MojoExecutionException, IOException {
+public void testCopyFile() throws Exception {

Review Comment:
   I like to know when an exception is added or removed from an API, and I'd 
make the same comment about the other methods in this class. :-)





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17849021#comment-17849021
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1611946471


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws IOException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
IOException, MojoExecutionException {
+log.info("Copying " + source + " to " + destination);

Review Comment:
   Log removed from method argument





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17849017#comment-17849017
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1611937502


##
src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java:
##
@@ -80,7 +80,7 @@ public void assertNoMarkerFile(Artifact artifact) throws 
MojoExecutionException
 assertFalse(handle.isMarkerSet());
 }
 
-public void testCopyFile() throws MojoExecutionException, IOException {
+public void testCopyFile() throws Exception {

Review Comment:
   It is a Unit Test ... all other methods simply throws `Exception`





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848942#comment-17848942
 ] 

ASF GitHub Bot commented on MDEP-923:
-

elharo commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1611629057


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws IOException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
IOException, MojoExecutionException {
+log.info("Copying " + source + " to " + destination);

Review Comment:
   YAGNI. I spend way too much time wading through maven logs trying to 
understand why and how builds failed. Info messages for normal operations just 
get in the way and make developers' jobs harder. That someone somewhere might 
one day want this message is not a good enough reason to include it.
   
   I can sort of see letting this slip through as a separate issue from the 
refactoring, though now that I look at it, I think that refactoring should also 
remove the log argument here too. This is a new public API we did not have 
before, and including that Log argument now makes it harder to remove later 
since it would be a public API change. 
   
   If the choice is between adding this method with the Log argument and not 
doing the refactoring, I think I'm going to pick not doing the refactoring. 





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848930#comment-17848930
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1611596047


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws IOException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
IOException, MojoExecutionException {
+log.info("Copying " + source + " to " + destination);
+
+if (source.isDirectory()) {
+// usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
+throw new MojoExecutionException("Artifact has not been packaged 
yet. When used on reactor artifact, "
++ "copy should be executed after packaging: see 
MDEP-187.");

Review Comment:
   try paste it in your favorite web search  
   here similar - it is refactor not improvements





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848928#comment-17848928
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1611591836


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws IOException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
IOException, MojoExecutionException {
+log.info("Copying " + source + " to " + destination);

Review Comment:
   As I said - I want to keep this as only refactor - without impact on final 
features
   
   If we want to remove such logs it should be a new issue for it ... maybe 
someone like or  use it





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848913#comment-17848913
 ] 

ASF GitHub Bot commented on MDEP-923:
-

elharo commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1611510587


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws IOException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
IOException, MojoExecutionException {
+log.info("Copying " + source + " to " + destination);

Review Comment:
   Log message is likely noise. Either thew copy succeeds and no one wants to 
read this, ior it fails and an exception is thrown. Demote to debug or remove 
it.



##
src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java:
##
@@ -80,7 +80,7 @@ public void assertNoMarkerFile(Artifact artifact) throws 
MojoExecutionException
 assertFalse(handle.isMarkerSet());
 }
 
-public void testCopyFile() throws MojoExecutionException, IOException {
+public void testCopyFile() throws Exception {

Review Comment:
   did this change to throw a raw exception? Otherwise it's better to declare 
the actual exceptions instead of the common superclass. 



##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,66 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws IOException with a message if an error occurs.
+ */
+

[jira] [Commented] (MDEP-923) Code cleanups

2024-05-22 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848754#comment-17848754
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1610688853


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
MojoExecutionException {
+try {
+log.info("Copying " + source + " to " + destination);
+
+if (source.isDirectory()) {
+// usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
+throw new MojoExecutionException("Artifact has not been 
packaged yet. When used on reactor artifact, "
++ "copy should be executed after packaging: see 
MDEP-187.");
+}
+
+FileUtils.copyFile(source, destination);
+buildContext.refresh(destination);
+} catch (IOException e) {

Review Comment:
   done - please look





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-22 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848726#comment-17848726
 ] 

ASF GitHub Bot commented on MDEP-923:
-

elharo commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1610545049


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
MojoExecutionException {
+try {
+log.info("Copying " + source + " to " + destination);
+
+if (source.isDirectory()) {
+// usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
+throw new MojoExecutionException("Artifact has not been 
packaged yet. When used on reactor artifact, "
++ "copy should be executed after packaging: see 
MDEP-187.");
+}
+
+FileUtils.copyFile(source, destination);
+buildContext.refresh(destination);
+} catch (IOException e) {

Review Comment:
   I'm less sure about that one. That feels close to a MojoExecutionExcepitojn 
to me. It's OK for on method to throw different exception types for different 
reasons. 





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-22 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848723#comment-17848723
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1610532357


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
MojoExecutionException {
+try {
+log.info("Copying " + source + " to " + destination);
+
+if (source.isDirectory()) {
+// usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
+throw new MojoExecutionException("Artifact has not been 
packaged yet. When used on reactor artifact, "
++ "copy should be executed after packaging: see 
MDEP-187.");
+}
+
+FileUtils.copyFile(source, destination);
+buildContext.refresh(destination);
+} catch (IOException e) {

Review Comment:
   See line 60 - we have `MojoExecutionException`  - I change it for 
`IOException` so ww will have one exception from method - @elharo what do you 
think?



##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+

[jira] [Commented] (MDEP-923) Code cleanups

2024-05-21 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848369#comment-17848369
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1608868000


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
MojoExecutionException {
+try {
+log.info("Copying " + source + " to " + destination);
+
+if (source.isDirectory()) {
+// usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
+throw new MojoExecutionException("Artifact has not been 
packaged yet. When used on reactor artifact, "
++ "copy should be executed after packaging: see 
MDEP-187.");
+}
+
+FileUtils.copyFile(source, destination);
+buildContext.refresh(destination);
+} catch (IOException e) {

Review Comment:
   We will have a `MojoExecutionException` and `IOException` from this method





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-21 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17848366#comment-17848366
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1608865499


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
MojoExecutionException {
+try {

Review Comment:
   As it is only refactor I don't want to change behavior.





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-20 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17847872#comment-17847872
 ] 

ASF GitHub Bot commented on MDEP-923:
-

elharo commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1606747610


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {

Review Comment:
   No interface needed. If I'm simply wrong about where this used, then by all 
means make it as public as it needs to be.





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-20 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17847870#comment-17847870
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1606737874


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {

Review Comment:
   It is used in another packages of project  so must be a public 
   I can add an interface - which still be a public and implementation which 
can be package visible, but I'm not sure if needed





> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-20 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17847862#comment-17847862
 ] 

ASF GitHub Bot commented on MDEP-923:
-

elharo commented on code in PR #389:
URL: 
https://github.com/apache/maven-dependency-plugin/pull/389#discussion_r1606679274


##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File destination) throws 
MojoExecutionException {
+try {
+log.info("Copying " + source + " to " + destination);
+
+if (source.isDirectory()) {
+// usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
+throw new MojoExecutionException("Artifact has not been 
packaged yet. When used on reactor artifact, "
++ "copy should be executed after packaging: see 
MDEP-187.");
+}
+
+FileUtils.copyFile(source, destination);
+buildContext.refresh(destination);
+} catch (IOException e) {

Review Comment:
   Since this isn't a Mojo itself, consider simply letting the IOException 
bubble up and handle it at a higher level.



##
src/main/java/org/apache/maven/plugins/dependency/utils/CopyUtil.java:
##
@@ -0,0 +1,70 @@
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Provide a copyFile method in one place.
+ */
+@Named
+@Singleton
+public class CopyUtil {
+
+private final BuildContext buildContext;
+
+@Inject
+public CopyUtil(BuildContext buildContext) {
+this.buildContext = buildContext;
+}
+
+/**
+ * Does the actual copy of the file and logging.
+ *
+ * @param source represents the file to copy.
+ * @param destination file name of destination file.
+ * @throws MojoExecutionException with a message if an error occurs.
+ */
+public void copyFile(Log log, File source, File 

[jira] [Commented] (MDEP-923) Code cleanups

2024-05-11 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17845584#comment-17845584
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski opened a new pull request, #389:
URL: https://github.com/apache/maven-dependency-plugin/pull/389

   this method is only needed in CopyMojo and CopyDependenciesMojo so it is not 
needed in AbstractDependencyMojo
   




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  * Remove plexus logger from DependencySilentLog
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-06 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17843865#comment-17843865
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski merged PR #388:
URL: https://github.com/apache/maven-dependency-plugin/pull/388




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
>  * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-05-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17843550#comment-17843550
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski opened a new pull request, #388:
URL: https://github.com/apache/maven-dependency-plugin/pull/388

   (no comment)




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
>  * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-04-24 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17840564#comment-17840564
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski merged PR #383:
URL: https://github.com/apache/maven-dependency-plugin/pull/383




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
>  * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-04-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17840236#comment-17840236
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski opened a new pull request, #383:
URL: https://github.com/apache/maven-dependency-plugin/pull/383

   (no comment)




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
>  * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-04-21 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17839386#comment-17839386
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski merged PR #379:
URL: https://github.com/apache/maven-dependency-plugin/pull/379




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
>  * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MDEP-923) Code cleanups

2024-04-21 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MDEP-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17839379#comment-17839379
 ] 

ASF GitHub Bot commented on MDEP-923:
-

slawekjaranowski opened a new pull request, #379:
URL: https://github.com/apache/maven-dependency-plugin/pull/379

   https://issues.apache.org/jira/browse/MDEP-923




> Code cleanups
> -
>
> Key: MDEP-923
> URL: https://issues.apache.org/jira/browse/MDEP-923
> Project: Maven Dependency Plugin
>  Issue Type: Task
>Reporter: Slawomir Jaranowski
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
>  * remove usage of deprecated API where possible
>  * cleanup pom after update to 42
>  * exclude transitive dependencies on org.apache.maven
>  * add {{@project.version@}} in ITs
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)