[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

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


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17811490#comment-17811490
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

slawekjaranowski commented on code in PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#discussion_r1468436721


##
src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java:
##
@@ -158,14 +188,91 @@ void updateDependencySetResolutionRequirements(
 
 Set dependencyArtifacts = null;
 if (set.isUseTransitiveDependencies()) {
-dependencyArtifacts = project.getArtifacts();
+try {
+// we need resolve project again according to requested 
scope
+dependencyArtifacts = resolveTransitive(systemSession, 
set.getScope(), project);
+} catch 
(org.eclipse.aether.resolution.DependencyResolutionException e) {
+throw new DependencyResolutionException(e.getMessage(), e);
+}
 } else {
+// FIXME remove using deprecated method
 dependencyArtifacts = project.getDependencyArtifacts();
 }
 
 requirements.addArtifacts(dependencyArtifacts);
-LOGGER.debug("Dependencies for project: " + project.getId() + " 
are:\n"
-+ StringUtils.join(dependencyArtifacts.iterator(), "\n"));
+if (LOGGER.isDebugEnabled()) {
+LOGGER.debug(
+"Dependencies for project: {} are:\n{}",
+project.getId(),
+StringUtils.join(dependencyArtifacts.iterator(), 
"\n"));
+}
 }
 }
+
+private Set resolveTransitive(
+RepositorySystemSession repositorySession, String scope, 
MavenProject project)
+throws org.eclipse.aether.resolution.DependencyResolutionException 
{
+
+// scope dependency filter
+DependencyFilter scoopeDependencyFilter = 
DependencyFilterUtils.classpathFilter(scope);
+
+// get project dependencies filtered by requested scope
+List dependencies = project.getDependencies().stream()
+.map(d -> RepositoryUtils.toDependency(d, 
repositorySession.getArtifactTypeRegistry()))
+.filter(d -> scoopeDependencyFilter.accept(new 
DefaultDependencyNode(d), null))
+.collect(Collectors.toList());
+
+List managedDependencies = 
Optional.ofNullable(project.getDependencyManagement())
+.map(DependencyManagement::getDependencies)
+.map(list -> list.stream()
+.map(d -> RepositoryUtils.toDependency(d, 
repositorySession.getArtifactTypeRegistry()))
+.collect(Collectors.toList()))
+.orElse(null);
+
+CollectRequest collectRequest = new CollectRequest();
+collectRequest.setManagedDependencies(managedDependencies);
+collectRequest.setRepositories(project.getRemoteProjectRepositories());
+collectRequest.setDependencies(dependencies);
+
collectRequest.setRootArtifact(RepositoryUtils.toArtifact(project.getArtifact()));
+
+DependencyRequest request = new DependencyRequest(collectRequest, 
scoopeDependencyFilter);
+
+DependencyResult dependencyResult = 
repositorySystem.resolveDependencies(repositorySession, request);
+
+// cache for artifact mapping
+Map 
etherToMavenArtifacts = new HashMap<>();

Review Comment:
   fixed





> Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

2024-01-09 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17804899#comment-17804899
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

slawekjaranowski commented on code in PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#discussion_r1446680127


##
pom.xml:
##
@@ -108,10 +108,9 @@ under the License.
 
 
   org.eclipse.aether
-  aether-api
+  aether-util
Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

2024-01-08 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17804164#comment-17804164
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

cstamas commented on PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#issuecomment-1880547415

   LGTM




> Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

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


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17804155#comment-17804155
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

gnodet commented on code in PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#discussion_r1444247702


##
pom.xml:
##
@@ -108,10 +108,9 @@ under the License.
 
 
   org.eclipse.aether
-  aether-api
+  aether-util
Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

2023-12-31 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17801420#comment-17801420
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

slawekjaranowski commented on PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#issuecomment-1872896877

   @cstamas -  kindly reminder




> Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

2023-12-27 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17800826#comment-17800826
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

slawekjaranowski commented on PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#issuecomment-1870463575

   @cstamas please look - build pass




> Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Assignee: Slawomir Jaranowski
>Priority: Major
> Fix For: 3.7.0
>
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

2023-11-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17786354#comment-17786354
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

cstamas commented on code in PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#discussion_r1394207292


##
pom.xml:
##
@@ -71,8 +71,8 @@ under the License.
   
 8
 2.2.0
-3.2.5
-1.7.5
+3.9.5

Review Comment:
   No ,is irrelevant





> Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Priority: Major
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

2023-11-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17786345#comment-17786345
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

slawekjaranowski commented on code in PR #166:
URL: 
https://github.com/apache/maven-assembly-plugin/pull/166#discussion_r1394176097


##
pom.xml:
##
@@ -71,8 +71,8 @@ under the License.
   
 8
 2.2.0
-3.2.5
-1.7.5
+3.9.5

Review Comment:
   Do we need such update for this exercises?





> Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Priority: Major
>
> This affects all assembly releases.



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


[jira] [Commented] (MASSEMBLY-1008) Assembly plugin handles scopes wrongly

2023-11-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MASSEMBLY-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17786339#comment-17786339
 ] 

ASF GitHub Bot commented on MASSEMBLY-1008:
---

cstamas opened a new pull request, #166:
URL: https://github.com/apache/maven-assembly-plugin/pull/166

   This IT demonstrates how assembly plugin (among others) does it wrongly, as 
the plugin code probably originates from Maven2 times.
   
   What happens:
   * "single" mojo resolves test project dependencies (see Mojo annotations)
   * then it reads assembly descriptor (so it only learns now what user wants)
   * then uses resolved project dependencies to deliver descriptor contents
   
   But, here is a problem that IT demonstrates: the delivered list of files are 
NOT runtime scoped, they are "test scope filtered for runtime leaves" which is 
not the same thing. By the way, dependency plugin demonstrates same behavior: 
wrongly assumes that "test" graph is super set of "runtime" tree, but that is 
not true nor was never true since Maven3 (resolver), it was true ONLY in Maven2 
times.
   
   The proper runtime graph of IT project as shown by resolver is this:
   ```
   prompt> graph test:massembly-1008:jar:1
   [INFO] Collecting test:massembly-1008:jar:1
   [INFO] 
   [INFO] test:massembly-1008:jar:1
   [INFO] \- com.google.inject:guice:jar:6.0.0 [compile]
   [INFO]+- javax.inject:javax.inject:jar:1 [compile]
   [INFO]+- jakarta.inject:jakarta.inject-api:jar:2.0.1 [compile]
   [INFO]+- aopalliance:aopalliance:jar:1.0 [compile]
   [INFO]\- com.google.guava:guava:jar:31.0.1-jre [compile]
   [INFO]   +- com.google.guava:failureaccess:jar:1.0.1 [compile]
   [INFO]   +- 
com.google.guava:listenablefuture:jar:.0-empty-to-avoid-conflict-with-guava 
[compile]
   [INFO]   +- com.google.code.findbugs:jsr305:jar:3.0.2 [compile]
   [INFO]   +- org.checkerframework:checker-qual:jar:3.12.0 [compile]
   [INFO]   +- com.google.errorprone:error_prone_annotations:jar:2.7.1 
[compile]
   [INFO]   \- com.google.j2objc:j2objc-annotations:jar:1.3 [compile]
   prompt> 
   ```




> Assembly plugin handles scopes wrongly
> --
>
> Key: MASSEMBLY-1008
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-1008
> Project: Maven Assembly Plugin
>  Issue Type: Bug
>  Components: dependencySet
>Reporter: Tamas Cservenak
>Priority: Major
>
> This affects all assembly releases.



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